/* Modern font pairing with variable font support */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Raleway:wght@300;400;500;600;700&display=swap');

:root {
  /* Modern color palette - Light Theme (Default) */
  --primary: #e63946;     /* Refined red */
  --secondary: #457b9d;   /* Accent blue */
  --dark: #1d3557;        /* Dark blue for text */
  --light: #f7f0f4;       /* Pale beige background */
  --gray: #a8dadc;        /* Light blue-gray accent */
  --shadow: rgba(0, 0, 0, 0.1);
  --card-bg: #ffffff;     /* Card background */
  --nav-bg: rgba(255, 255, 255, 0.95); /* Navigation background */
  --footer-bg: #1d3557; /* Footer background */
  --footer-text: #ffffff; /* Footer text color */
  --border-color: #ddd;   /* Border color */
  --transition: all 0.5s ease; /* Increased from 0.3s to 0.5s */
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --primary: #ff5252;           /* Vibrant red accent */
  --secondary: #40c9ff;         /* Bright blue accent */
  --dark: #f5f6fa;              /* Light text for dark mode */
  --light: #181a1b;             /* Deep dark background */
  --gray: #23272f;              /* Card/section background */
  --shadow: rgba(0,0,0,0.6);    /* Stronger shadow for depth */
  --card-bg: #23272f;           /* Card background */
  --nav-bg: rgba(24,26,27,0.97);/* Navigation background */
  --footer-bg: #181a1b;         /* Footer background */
  --footer-text: #f5f6fa;       /* Footer text color */
  --border-color: #353b48;      /* Subtle border */
}

* {
    font-family: "Raleway", sans-serif;
    color: var(--dark);
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Add this to ensure smooth transitions for all theme-affected elements */
* {
    transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease;
}

/* Update body transition */
body {
    background-color: var(--light);
    line-height: 1.6;
    transition: background-color 0.5s ease !important;
}

/* Ensure all elements using CSS variables transition smoothly */
.navigation, .timeline-item, .project, .competition-item, 
.contact-form input, .contact-form textarea, .contact-form button,
.section-title, .section-subtitle, .nav-but, .footer {
    transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease !important;
}

/* Modern navigation with subtle glass effect */
.navigation {
    margin: 0;
    padding: 15px 30px;
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--nav-bg);
    backdrop-filter: blur(10px);
    z-index: 9999;
    box-shadow: 0 2px 15px var(--shadow);
    transition: var(--transition);
}

/* Theme Toggle Button */
.theme-toggle {
    display: flex;
    align-items: center;
    margin-left: 15px;
    cursor: pointer;
}

.theme-toggle-icon {
    width: 24px;
    height: 24px;
    position: relative;
    transition: transform 1s ease; /* Increased to 1s for a more fluid rotation */
}

.sun {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    background-color: #f9d71c;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(249, 215, 28, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Sun rays (short and balanced) */
  .sun .ray {
    position: absolute;
    width: 2px;
    height: 8px;
    background-color: #f9d71c;
    border-radius: 1px;
  }
  
  .sun .ray:nth-child(1) { transform: rotate(0deg) translateY(-12px); }
  .sun .ray:nth-child(2) { transform: rotate(45deg) translateY(-12px); }
  .sun .ray:nth-child(3) { transform: rotate(90deg) translateY(-12px); }
  .sun .ray:nth-child(4) { transform: rotate(135deg) translateY(-12px); }
  .sun .ray:nth-child(5) { transform: rotate(180deg) translateY(-12px); }
  .sun .ray:nth-child(6) { transform: rotate(225deg) translateY(-12px); }
  .sun .ray:nth-child(7) { transform: rotate(270deg) translateY(-12px); }
  .sun .ray:nth-child(8) { transform: rotate(315deg) translateY(-12px); }
  
  /* Optional hover effect for the sun */
  .theme-toggle:hover .sun {
    transform: rotate(20deg) scale(1.1);
  }
  

/* Moon Icon */
.moon {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    background-color: var(--dark);
    border-radius: 50%;
    transform: scale(0);
    transition: all 0.3s ease;
}

.moon::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    width: 24px;
    height: 24px;
    background-color: var(--light);
    border-radius: 50%;
    transform: translate(7px, -7px);
    transition: all 0.3s ease;
}

/* Dark Theme Icon States */
[data-theme="dark"] .sun {
    transform: scale(0);
}

[data-theme="dark"] .moon {
    transform: scale(0.6);
}

/* Rotate animation for theme toggle */
.theme-toggle:hover .theme-toggle-icon {
    transform: rotate(180deg);
}

/* Update existing styles for dark mode compatibility */
.timeline-item,
.project,
.competition-card,
.contact-form,
.social-links a {
    background-color: var(--card-bg);
    transition: var(--transition), transform 0.4s ease, box-shadow 0.4s ease;
}

input[type="text"],
input[type="email"],
textarea {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--dark);
    transition: var(--transition), border-color 0.3s ease, box-shadow 0.3s ease;
}

footer {
    background-color: var(--footer-bg);
}

footer .container p {
    color: var(--footer-text);
}

.nav {
    display: flex;
    justify-content: center;
    width: 100%;
}

.nav a {
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
    font-size: 18px;
    margin-right: 30px;
    padding: 5px 0;
    position: relative;
    transition: var(--transition);
}

.nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--primary);
    transition: var(--transition);
}

.nav a:hover::after {
    width: 100%;
}

.nav a:hover {
    color: var(--primary);
}

.lang-select {
    display: flex;
    align-items: center;
    margin-right: 15px;
}

.lang-select a {
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
    font-size: 18px;
    margin-left: 10px;
    transition: var(--transition);
}

.lang-select a:hover {
    color: var(--primary);
}

#active-lang {
    color: var(--primary);
    font-weight: 600;
}

#active {
    color: var(--primary);
    font-weight: 600;
}

#active::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--primary);
}

#red {
    color: var(--primary);
    font-weight: 600;
}

.main {
    padding-top: 80px;
}

/* Modern hero section */
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.me {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-right: 5%;
    max-width: 600px;
}

.me h1 {
    font-family: "Poppins", sans-serif;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
    color: var(--dark);
}

.me p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 30px;
}

#photo {
    max-width: 100%;
    height: auto;
    border-radius: 20px;
    box-shadow: 0 15px 30px var(--shadow);
    transition: transform 0.5s ease;
}

#photo:hover {
    transform: translateY(-10px);
}

hr {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--gray), transparent);
    margin: 40px 0;
}

/* Section headings */
h1 {
    font-family: "Poppins", sans-serif;
    text-align: center;
    margin: 60px 0 40px;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark);
    position: relative;
    padding-bottom: 15px;
}

h1::after {
    content: '';
    position: absolute;
    width: 80px;
    height: 3px;
    background-color: var(--primary);
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

/* Modern timeline */
.timeline {
    position: relative;
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray);
    left: 50%;
    margin-left: -1px;
}

.timeline-item {
    padding: 20px 30px;
    background-color: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 5px 15px var(--shadow);
    margin-bottom: 40px;
    position: relative;
    width: 45%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.timeline-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.timeline-item::after {
    content: '';
    position: absolute;
    top: 20px;
    width: 20px;
    height: 20px;
    background-color: white;
    border: 4px solid var(--primary);
    border-radius: 50%;
}

.timeline-item:nth-child(odd) {
    left: 0;
}

.timeline-item:nth-child(even) {
    left: 55%;
}

.timeline-item:nth-child(odd)::after {
    right: -60px;
}

.timeline-item:nth-child(even)::after {
    left: -60px;
}

.timeline-item:nth-child(even) {
    border-left: none;
    border-right: none;
}

.timeline-content {
    background-color: transparent;
    padding: 0;
}

.timeline-content h3 {
    font-family: "Poppins", sans-serif;
    margin-top: 0;
    color: var(--primary);
    font-size: 1.5rem;
}

.timeline-content p {
    margin-bottom: 10px;
}

/* Modern project cards */
.projects-container, .competitions-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    padding: 20px 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.project, .competition-card {
    flex: 1 1 350px;
    max-width: 400px;
    background-color: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 20px var(--shadow);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    display: flex;
    flex-direction: column;
}

.project:hover, .competition-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.project img, .competition-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.project:hover img, .competition-card:hover img {
    transform: scale(1.05);
}

.project-info, .competition-info {
    padding: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.project-info h3, .competition-info h3 {
    font-family: "Poppins", sans-serif;
    margin-top: 0;
    margin-bottom: 15px;
    text-align: center;
    color: var(--dark);
    font-size: 1.5rem;
}

.project-info p, .competition-info p {
    margin-bottom: 20px;
    line-height: 1.7;
    flex-grow: 1;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 30px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
    align-self: center;
    box-shadow: 0 4px 10px rgba(230, 57, 70, 0.3);
}

.btn:hover {
    background-color: #d62839;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(230, 57, 70, 0.4);
}

/* Modern contact form */
.contact-form {
    max-width: 650px;
    margin: 40px auto;
    padding: 40px;
    background-color: var(--card-bg);
    border-radius: 15px;
    box-shadow: 0 10px 30px var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.contact-form form {
    width: 100%;
}

.form-group {
    margin-bottom: 25px;
    width: 100%;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
}

input[type="text"],
input[type="email"],
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.2);
    outline: none;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.btnn {
    display: block;
    width: 100%;
    padding: 12px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(230, 57, 70, 0.3);
}

.btnn:hover {
    background-color: #d62839;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(230, 57, 70, 0.4);
}

/* Modern social links */
.social-links {
    margin: 40px 0;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background-color: white;
    border-radius: 50%;
    box-shadow: 0 5px 15px var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.social-links img {
    width: 25px;
    height: 25px;
    transition: transform 0.3s ease;
}

.social-links a:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.social-links a:hover img {
    transform: scale(1.2);
}

/* Modern footer */
footer {
    background-color: var(--footer-bg);
    color: white;
    text-align: center;
    padding: 30px 0;
    margin-top: 60px;
}

footer .container p {
    color: white;
    font-size: 0.9rem;
}

.certificates-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    padding: 20px 5%;
    max-width: 1400px;
    margin: 0 auto;
  }
  
  .certificate-card {
    flex: 1 1 300px;
    max-width: 350px;
    background-color: var(--card-bg);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 20px var(--shadow);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    display: flex;
    flex-direction: column;
  }
  
  .certificate-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
  }
  
  .certificate-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.5s ease;
  }
  
  .certificate-card:hover img {
    transform: scale(1.05);
  }
  
  .certificate-info {
    padding: 20px;
    text-align: center;
  }
  
  .certificate-info h3 {
    font-family: "Poppins", sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 10px;
  }
  
  .certificate-info p {
    font-size: 0.95rem;
    color: var(--dark);
    margin-bottom: 15px;
  }
  
  .certificate-info .btn {
    margin-top: 10px;
  }

  /* Modal Styles */
.certificate-modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.8);
  }
  
  .modal-content {
    margin: 5% auto;
    max-width: 800px;
    position: relative;
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    animation: fadeIn 0.3s ease;
  }
  
  .modal-content img {
    width: 100%;
    height: auto;
    border-radius: 10px;
  }
  
  .close-btn {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 40px;
    height: 40px;
    font-size: 48px;
    line-height: 40px;
    text-align: center;
    color: var(--primary);
    cursor: pointer;
    background: var(--card-bg);
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: color 0.3s ease, transform 0.2s ease;
  }
  
  .close-btn:hover {
    color: #d62839;
    transform: scale(1.1);
  }
  
  
  #modal-title {
    font-size: 1.2rem;
    font-weight: 600;
  }
  
  
  @keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
  }

  

/* Responsive design */
@media only screen and (max-width: 992px) {
    .timeline::before {
        left: 30px;
    }
    
    .timeline-item {
        width: 100%;
        padding-left: 70px;
    }
    
    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        left: 0;
    }
    
    .timeline-item:nth-child(odd)::after,
    .timeline-item:nth-child(even)::after {
        left: 15px;
    }
}

@media only screen and (max-width: 768px) {
    .navigation {
        padding: 10px 15px;
        flex-direction: column;
    }
    
    .nav {
        flex-wrap: wrap;
        justify-content: center;
        margin-bottom: 10px;
    }
    
    .nav a {
        margin: 5px 10px;
        font-size: 16px;
    }
    
    .lang-select {
        justify-content: center;
        margin-right: 0;
    }
    
    .main {
        padding-top: 120px;
    }
    
    .container {
        flex-direction: column-reverse;
        padding: 30px 5%;
    }
    
    .me {
        margin-right: 0;
        margin-top: 30px;
        text-align: center;
        align-items: center;
    }
    
    .me h1 {
        font-size: 2.2rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .project, .competition-card {
        flex: 1 1 300px;
    }
    
    .contact-form {
        padding: 25px;
    }
    
    #photo {
        margin-top: 0 !important;
    }
}

@media only screen and (max-width: 480px) {
    .me h1 {
        font-size: 1.8rem;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    .timeline-item {
        padding: 15px 15px 15px 60px;
    }
    
    .social-links a {
        width: 40px;
        height: 40px;
    }
    
    .social-links img {
        width: 20px;
        height: 20px;
    }
}

