/* Import Google Fonts - typically done at the top of your CSS file */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500&display=swap');

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    background-color: #222831;
    color: white;
    overflow-x: hidden; /* Prevent horizontal scroll */
    min-height: 100vh;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 5%;
    position: relative;
    z-index: 10;
    min-height: 40px;
    flex-wrap: wrap;
    gap: 10px;
}

.logo-section { /* This class is not used in your HTML, consider removing if not needed */
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.header-right { /* This class is not used in your HTML, consider removing if not needed */
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.logo-icon {
    width: 35px;
    height: 35px;
    position: relative;
    box-sizing: border-box;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.site-title {
    font-size: clamp(18px, 4vw, 24px);
    font-weight: 500;
    white-space: nowrap;
    margin-left: -10px;
}

.nav-links {
    display: flex;
    gap: 15px;
    margin-left: clamp(20px, 8vw, 100px);
    flex-shrink: 0;
}

.nav-links a {
    color: white;
    font-size: clamp(14px, 2.5vw, 18px);
    text-decoration: none;
    padding: 10px 15px;
    min-width: 80px;
    text-align: center;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    border-radius: 8px;
    white-space: nowrap;
}

.nav-links a:hover {
    color: #00ADB5;
}

.search-container {
    display: flex;
    width: 168px;
    height: 48px;
    padding: 10px 13px;
    align-items: center;
    gap: 9px;
    flex-shrink: 0;
    border-radius: 20px;
    border: 2px solid #4A709C;
    background: #BFC8D7;
    margin-left: auto;
}

.search-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.search-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.search-input {
    color: black;
    font-size: clamp(12px, 2.5vw, 16px);
    font-weight: 400;
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    flex: 1;
}

.search-input::placeholder {
    color: rgba(0, 0, 0, 0.6);
}

.profile-icon { /* This class is not used in your HTML, consider removing if not needed */
    width: clamp(40px, 8vw, 60px);
    height: clamp(40px, 8vw, 60px);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.profile-icon img { /* This class is not used in your HTML, consider removing if not needed */
    width: 70%;
    height: 70%;
    object-fit: contain;
}

.profile-icon:hover { /* This class is not used in your HTML, consider removing if not needed */
    transform: scale(1.05);
}

.divider {
    width: 100%;
    height: 2px;
    background-color: #E8EDF5;
    margin-top: -5px;
}

/* --- HERO SECTION STYLES (UPDATED) --- */
.hero-section {
    position: relative;
    margin: 20px 5%;
    width: 90%;
    min-height: 400px;
    border-radius: 40px;
    border: 2px #00ADB5 solid;
    display: flex; /* Use flexbox for layout */
    justify-content: space-between; /* Space between image and text */
    align-items: center;
    box-sizing: border-box;
    overflow: hidden; /* Important for containing rounded corners and potential overflows */
    padding: 40px; /* This padding reduces the available space inside */
    background: linear-gradient(135deg, #222831 0%, #393E46 100%);
    gap: 40px; /* Space between the image and text containers */
}

.hero-image-container {
    flex: 0 0 auto; /* Do not grow, do not shrink automatically, base size on content/max-width */
    max-width: 359px; /* Max width it can be, matching your Figma design */
    width: 100%; /* Take up 100% of available space up to max-width */
    aspect-ratio: 1/1; /* Maintain a perfect square aspect ratio */
    border-radius: 40px;
    overflow: hidden; /* Hide anything that goes outside the rounded corners */
    background-color: #393E46; /* A slightly lighter dark background, as before */
    display: flex; /* Use flex to center the image if it doesn't fill the container */
    justify-content: center;
    align-items: center;
}

.hero-image-container img {
    width: 359px; /* Fixed width */
    height: 359px; /* Fixed height */
    object-fit: cover; /* Crop if necessary to fill the square */
    display: block; /* Remove extra space below image */
    border-radius: 20px; /* Add rounded corners */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); /* Add shadow */
    -webkit-transform: translateZ(0); /* Force hardware acceleration on Safari */
    transform: translateZ(0); /* Force hardware acceleration */
    -webkit-backface-visibility: hidden; /* Prevent Safari rendering issues */
    backface-visibility: hidden; /* Prevent rendering issues */
}

.hero-text-container {
    flex: 1; /* Allow text container to take remaining space */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    z-index: 2;
    position: relative;
    padding-left: 20px; /* Add some padding to separate from image on large screens */
}

.hero-title {
    font-size: clamp(24px, 6vw, 36px);
    font-weight: 400;
    margin-bottom: 15px;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: clamp(14px, 3.5vw, 20px);
    font-weight: 400;
    margin-top: 0;
    margin-bottom: 30px;
    max-width: 100%;
    line-height: 1.4;
}

.explore-button {
    background: #00ADB5;
    border-radius: 20px;
    border: 3px #0D141C solid;
    padding: 12px 25px;
    color: black;
    font-size: clamp(16px, 3.5vw, 20px);
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 180px;
    height: 50px;
    box-sizing: border-box;
    transition: background-color 0.3s ease, transform 0.2s ease;
    white-space: nowrap;
}

.explore-button:hover {
    background: #009aa1;
    transform: translateY(-2px);
}

/* --- POPULAR NOTES SECTION STYLES --- */
.popular-notes-section {
    margin: 40px 5%;
    width: 90%;
}

.popular-notes-title {
    font-size: clamp(18px, 4vw, 20px);
    font-weight: 500;
    margin-bottom: 30px;
    text-align: center;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 30px;
    justify-items: center;
    max-width: 600px;
    margin: 0 auto;
}

.note-item {
    width: 100%;
    max-width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.note-item:hover {
    transform: translateY(-5px);
}

.note-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    border-radius: 10px;
    object-fit: cover;
    margin-bottom: 10px;
}

.note-item-title {
    font-size: clamp(10px, 2.5vw, 12px);
    font-weight: 400;
    color: white;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
    word-wrap: break-word;
}

/* --- RESPONSIVE DESIGN (UPDATED) --- */

/* Safari-specific fixes */
@supports (-webkit-appearance: none) {
    .hero-image-container img {
        width: 359px !important;
        height: 359px !important;
        min-width: 359px;
        min-height: 359px;
        max-width: 359px;
        max-height: 359px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 12px 15px;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
    }
    
    .logo-icon img {
        width: 32px;
        height: 32px;
    }
    
    .site-title {
        font-size: 16px;
        margin: 0;
    }
    
    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 8px;
        margin-left: 0;
        gap: 20px;
    }
    
    .nav-links a {
        font-size: 14px;
        padding: 8px 16px;
        border-radius: 20px;
        background: rgba(0, 173, 181, 0.1);
        border: 1px solid rgba(0, 173, 181, 0.3);
        transition: all 0.3s ease;
    }
    
    .nav-links a:hover,
    .nav-links a.active {
        background: #00ADB5;
        color: #0D141C;
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(0, 173, 181, 0.3);
    }
    
    .search-container {
        min-width: 100px;
        padding: 8px 12px;
        margin-left: auto;
        border-radius: 20px;
    }
    
    .search-input {
        font-size: 14px;
    }
    
    .hero-section {
        flex-direction: column; /* Stack image and text vertically */
        padding: 30px 15px; /* Adjust padding for smaller screens */
        gap: 20px; /* Adjust gap for vertical stacking */
        min-height: auto; /* Allow height to adjust based on content */
        text-align: center; /* Center content within the section */
    }

    .hero-image-container {
        max-width: 80%; /* Limit image width to a percentage of its parent */
        width: 100%; /* Take full available width up to max-width */
        aspect-ratio: 1/1; /* Ensure it stays square */
        order: 1; /* Place image first in column flow */
        margin: 0 auto; /* Center the image container */
    }

    .hero-text-container {
        order: 2; /* Place text second in column flow */
        padding-left: 0; /* Remove padding for stacked layout */
        align-items: center; /* Center text content */
        text-align: center; /* Center text itself */
    }
    
    .hero-title, .hero-subtitle {
        text-align: center; /* Ensure title and subtitle are centered when stacked */
    }

    .popular-notes-section {
        margin: 30px 15px;
        width: calc(100% - 30px);
    }
    
    .notes-grid {
        gap: 20px;
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
}

@media (max-width: 480px) {
    .header {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        padding: 10px 12px;
        flex-wrap: wrap;
    }
    
    .logo-icon {
        width: 28px;
        height: 28px;
    }
    
    .logo-icon img {
        width: 28px;
        height: 28px;
    }
    
    .site-title {
        font-size: 14px;
        text-align: left;
        margin: 0;
        flex: 1;
    }
    
    .nav-links {
        order: 3;
        width: 100%;
        margin-top: 8px;
        margin-left: 0;
        justify-content: center;
        gap: 15px;
    }
    
    .nav-links a {
        font-size: 13px;
        padding: 6px 12px;
        border-radius: 15px;
    }
    
    .search-container {
        order: 2;
        align-self: center;
        max-width: 120px;
        margin-left: 0;
        padding: 6px 10px;
    }
    
    .search-input {
        font-size: 13px;
    }
    
    .profile-icon { /* This class is not used in your HTML, consider removing if not needed */
        order: 5;
        align-self: center;
    }
    
    .hero-section {
        margin: 15px 10px;
        width: calc(100% - 20px);
        padding: 25px 15px;
    }
    
    .hero-image-container {
        max-width: 90%; /* Allow image to take more width on very small screens */
    }

    .hero-title {
        font-size: 20px;
    }
    
    .hero-subtitle {
        font-size: 14px;
    }
    
    .explore-button {
        min-width: 150px;
        height: 45px;
        font-size: 16px;
    }
    
    .notes-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 15px;
    }
}

@media (min-width: 1200px) {
    .header {
        padding: 25px 8%;
    }
    
    .hero-section {
        margin: 60px 8%;
        width: 84%;
        min-height: 400px;
        flex-direction: row; /* Ensure side-by-side on large screens */
        padding: 40px; /* Restore original padding */
    }
    
    .hero-image-container {
        max-width: 359px; /* Revert to the exact Figma size */
        flex-basis: 359px; /* Give it a preferred size */
        height: 359px; /* Revert to the exact Figma size */
        margin: 0; /* Remove centering margin */
        order: 0; /* Ensure it's on the left */
    }

    .hero-text-container {
        padding-left: 20px; /* Revert to original padding */
        align-items: flex-start; /* Align text to start */
        text-align: left; /* Align text to left */
        order: 1; /* Ensure text is on the right */
    }
    
    .popular-notes-section {
        margin: 60px 8%;
        width: 84%;
    }
    
    .notes-grid {
        max-width: 800px;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

/* --- FOOTER STYLES --- */
.footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}

.signature {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 400;
    margin: 0;
    font-style: italic;
}

.legal-links {
    margin-top: 10px;
    text-align: center;
}

.legal-links a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.3s ease;
}

.legal-links a:hover {
    color: #00ADB5;
}

.separator {
    color: rgba(255, 255, 255, 0.4);
    margin: 0 10px;
    font-size: 12px;
}

.legal-section { /* This class is not used in your HTML, consider removing if not needed */
    margin: 20px 15%;
    width: 70%;
    color: white;
}

.legal-section h1 { /* This class is not used in your HTML, consider removing if not needed */
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
}

.legal-section h2 { /* This class is not used in your HTML, consider removing if not needed */
    font-size: 20px;
    font-weight: 500;
    margin-top: 30px;
    margin-bottom: 15px;
    color: #00ADB5;
}

.legal-section p { /* This class is not used in your HTML, consider removing if not needed */
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.copyright {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    margin-top: 10px;
    text-align: center;
}