/* Home-specific styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}


/* Extra small screens (phones in portrait) */
@media (max-width: 480px) {
    .navbar {
        padding: 0.5rem 0.8rem;
        height: 65px;
    }
    
    .nav-left .logo {
        font-size: 0.9rem;
    }
    
    .nav-center {
        margin: 0 0.5rem;
    }
    
    .search-box {
        font-size: 0.85rem;
        padding: 0.35rem 0.7rem;
    }
    
    .nav-right {
        gap: 0.3rem;
    }
    
    .icon-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.85rem;
    }
    
    .slider-container {
        margin: 0.75rem;
    }
    
    .slide {
        padding: 1.5rem 1rem;
        min-height: 260px;
    }
    
    .slide h1, .slide h2 {
        font-size: 1.2rem;
    }
    
    .slide p {
        font-size: 0.9rem;
    }
    
    .upload-btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .notes-grid {
        padding: 0.75rem;
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .card-cover-image {
        height: 160px;
    }
    
    .pdf-icon {
        width: 45px;
        height: 45px;
        margin: 0.8rem auto;
    }
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--navbar-bg);
    box-shadow: 0 2px 8px var(--shadow);
    height: 80px;
    max-width: 100%;
    overflow-x: hidden;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease;
}

.logo {
    text-decoration: none;
    color: var(--text-color);
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.nav-center {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    max-width: 400px;
    height: 40px;
    margin: 0 2rem;
}

.search-form {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    align-items: center;
}

.search-box {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    outline: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    background-color: var(--card-bg);
    color: var(--text-color);
}

.search-box:focus {
    border-color: #444444;
    box-shadow: 0 0 0 3px rgba(68, 68, 68, 0.2);
}

.dark-mode .search-box:focus {
    border-color: #555555;
    box-shadow: 0 0 0 3px rgba(85, 85, 85, 0.3);
}

.search-box::placeholder {
    color: var(--text-secondary);
}

.search-btn,
.icon-btn {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background-color: var(--border-color);
    border-radius: 8px;
}

.dark-mode .icon-btn:hover {
    background-color: #1a1a1a;
}

.nav-right {
    display: flex;
    gap: 1rem;
}

/* Notes Grid Styles */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    /* grid-template-columns: repeat(4,1fr); */
    gap: 1rem;
    padding: 2rem;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
}

.note-card {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow);
    transition: all 0.3s ease;
    position: relative;
}

.note-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.note-card:hover .card-cover-image {
    transform: scale(1.02);
}

.note-card:hover .note-info {
    background: var(--card-bg);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Cover image styles */
.card-cover-image {
    width: 100%;
    height: 280px;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: flex-end;
    background-color: var(--border-color);
    transition: all 0.3s ease;
    border-radius: 8px 8px 0 0;
    /* Ensure the image doesn't overflow the rounded corners */
    overflow: hidden;
}

.card-cover-image:not(.loaded) {
    opacity: 0.7;
    background: linear-gradient(45deg, var(--border-color) 25%, transparent 25%), 
                linear-gradient(-45deg, var(--border-color) 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, var(--border-color) 75%), 
                linear-gradient(-45deg, transparent 75%, var(--border-color) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.card-cover-image.loaded {
    opacity: 1;
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(transparent 0%, transparent 60%, rgba(0, 0, 0, 0.4) 85%, rgba(0, 0, 0, 0.7) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Add a subtle gradient at the bottom of the cover image for smooth transition */
.card-cover-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, var(--card-bg));
    pointer-events: none;
    z-index: 1;
}

.unit-code-overlay {
    color: white;
    font-weight: bold;
    font-size: 1.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;
    text-align: center;
}

/* PDF icon for units without cover images */
.pdf-icon {
    background-color: #fd4d4d;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem auto;
    font-weight: bold;
}

.note-info {
    padding: 1.5rem;
    text-align: center;
    position: relative;
    background: var(--card-bg);
    border-radius: 0 0 8px 8px;
    /* Add a subtle inner shadow to create depth */
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    /* Create a smooth transition effect */
    transform: translateZ(0);
    backface-visibility: hidden;
}

.course-code {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.note-info h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    min-height: 2.6em;
    color: var(--text-color);
}

.pages {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.price {
    font-weight: bold;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.view-pdf-btn {
    background-color: var(--button-bg);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.view-pdf-btn:hover {
    background-color: var(--button-hover);
    transform: translateY(-2px);
}

.dark-mode .view-pdf-btn {
    background-color: #1a1a1a;
    border: 1px solid #333333;
}

.dark-mode .view-pdf-btn:hover {
    background-color: #222222;
    border-color: #444444;
}

.course-code {
    margin-bottom: 0.5rem;
}

.pages {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}
.loader {
    position: relative;
    width: 100px;
    height: 16px;
    margin: 0 auto;
    align-items: center;
    justify-content: center;
  }
.loader:before , .loader:after{
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e70000;
    box-shadow: 32px 0 #220000;
    left: 0;
    top: 0;
    animation: ballMoveX 1s linear infinite;
  }
.loader:after {
    box-shadow: none;
    transform-origin: 40px 0;
    transform: rotate(-153deg);
    animation: rotateLoader 1s linear infinite;
  }

@keyframes rotateLoader {
    0% , 10%{ transform: rotate(-153deg); }
    90%, 100% { transform: rotate(0deg); }
  }
@keyframes ballMoveX {
    0% , 10%{  transform: translateX(0) }
    90%, 100% { transform: translateX(32px) }
  }
      
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    * {
        max-width: 100%;
    }
    
    /* Better navbar for mobile */
    .navbar {
        padding: 0.75rem 1rem;
        height: 70px;
        flex-wrap: nowrap;
    }
    
    .nav-left .logo {
        font-size: 1rem;
        font-weight: 700;
    }
    
    .nav-center {
        margin: 0 0.75rem;
        max-width: none;
        flex: 1;
        min-width: 0;
    }
    
    .search-box {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
        border-radius: 15px;
        min-width: 0;
    }
    
    .search-btn {
        padding: 0.4rem 0.8rem;
    }
    
    .nav-right {
        gap: 0.5rem;
        flex-shrink: 0;
    }
    
    .icon-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }
    
    /* Better slider for mobile */
    .slider-container {
        margin: 1rem;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .slide {
        padding: 2rem 1.5rem;
        min-height: 280px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        text-align: center;
    }
    
    .slide h1, .slide h2 {
        font-size: 1.4rem;
        line-height: 1.3;
        margin-bottom: 1rem;
        color: var(--text-color);
    }
    
    .slide p {
        font-size: 0.95rem;
        line-height: 1.5;
        color: var(--text-secondary);
        margin-bottom: 1.5rem;
        max-width: 90%;
        margin-left: auto;
        margin-right: auto;
    }
    
    .upload-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.95rem;
        border-radius: 25px;
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        justify-content: center;
        transition: all 0.3s ease;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        background-color: var(--button-bg);
    }
    
    .upload-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        background-color: var(--button-hover);
    }
    
    .dark-mode .upload-btn {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    }
    
    .dark-mode .upload-btn:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
    }
    
    /* Better navigation arrows */
    .prev-btn, .next-btn {
        padding: 0.8rem;
        font-size: 1rem;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        transition: all 0.3s ease;
    }
    
    .prev-btn {
        left: 10px;
    }
    
    .next-btn {
        right: 10px;
    }
    
    /* Better dots */
    .dots-container {
        bottom: 1.5rem;
        gap: 0.8rem;
    }
    
    .dot {
        width: 12px;
        height: 12px;
        transition: all 0.3s ease;
    }
    
    .dot.active {
        transform: scale(1.2);
    }
    
    /* Better notes grid */
    .notes-grid {
        padding: 1rem;
        gap: 1rem;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    .note-card {
        border-radius: 12px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
        transition: all 0.3s ease;
        overflow: hidden;
    }
    
    .note-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    }
    
    .card-cover-image {
        border-radius: 12px 12px 0 0;
    }
    
    .pdf-icon {
        width: 50px;
        height: 50px;
        margin: 1rem auto;
        font-size: 1.2rem;
    }
    
    .note-info {
        padding: 1rem;
    }
    
    .note-info h3 {
        font-size: 1rem;
        line-height: 1.4;
        min-height: 2.8em;
    }
    
    .view-pdf-btn {
        padding: 0.7rem 1rem;
        border-radius: 8px;
        font-size: 0.9rem;
        font-weight: 600;
        transition: all 0.3s ease;
    }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 480px) {
    .navbar {
        padding: 0.5rem 0.8rem;
        height: 65px;
    }
    
    .nav-left .logo {
        font-size: 0.9rem;
    }
    
    .nav-center {
        margin: 0 0.5rem;
    }
    
    .search-box {
        font-size: 0.85rem;
        padding: 0.35rem 0.7rem;
    }
    
    .nav-right {
        gap: 0.3rem;
    }
    
    .icon-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.85rem;
    }
    
    .slider-container {
        margin: 0.75rem;
    }
    
    .slide {
        padding: 1.5rem 1rem;
        min-height: 260px;
    }
    
    .slide h1, .slide h2 {
        font-size: 1.2rem;
    }
    
    .slide p {
        font-size: 0.9rem;
    }
    
    .upload-btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .notes-grid {
        padding: 0.75rem;
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

/* Mobile search improvements */
@media (max-width: 768px) {
    .search-form {
        gap: 0.3rem;
    }
    
    .search-box {
        -webkit-appearance: none;
        appearance: none;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Hide search button on mobile */
@media (max-width: 768px) {
    .search-btn {
        display: none;
    }
}
