/* ========================================================================== 
   Global Styles - Background Image with Overlay
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700&family=Nunito:wght@400;500;600;700&family=Quicksand:wght@500;700&display=swap');

body {
    position: relative;
    margin: 0;
    padding-top: 100px; /* Adjust for fixed navbar */
    font-family: 'Poppins', 'Nunito', 'Quicksand', sans-serif;
    font-size: calc(14px + 0.5vw);
    color: #2c3e50;
    touch-action: manipulation;
    /* Ensure /assests/background.webp exists in the root directory */
    background: url("background.jpg") no-repeat center center;
    background-size: cover;
    background-color: #f3f4f6; /* Fallback color if image fails to load */
}

/* Overlay temporarily disabled for debugging */
/*
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    z-index: -1;
}
*/

/* Wrapper for main content */
.content {
    position: relative;
    z-index: 1; /* ensures text is above overlay */
    text-align: center;
    padding: 5rem 2rem;
    font-size: 1.5rem;
    color: #333;
}

/* ========================================================================== 
   Rest of your existing CSS remains unchanged below 
   ========================================================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem;
}

/* ... other styles: buttons, forms, cards, navbar, login, materials showcase, footer ... */

h1, h2, h3, h4 {
    color: #e67e22;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

h1 { font-size: calc(2rem + 1vw); }
h2 { font-size: calc(1.5rem + 0.8vw); }
h4 { font-size: calc(1.2rem + 0.5vw); }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn-custom {
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 500;
    font-size: calc(0.9rem + 0.3vw);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    z-index: 1;
}

.btn-custom::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: 0.5s;
    z-index: 0;
}

.btn-custom:hover::before {
    left: 100%;
}

.btn-custom:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary-custom {
    background-color: #e67e22;
    color: white;
}
.btn-primary-custom:hover {
    background-color: #d35400;
}

.btn-secondary-custom {
    background-color: #2c3e50;
    color: white;
}
.btn-secondary-custom:hover {
    background-color: #1a252f;
}

.btn-danger-custom {
    background-color: #dc3545;
    color: white;
}
.btn-danger-custom:hover {
    background-color: #c82333;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-control {
    border-radius: 8px;
    border: 1px solid #ced4da;
    transition: all 0.3s ease;
    font-size: calc(0.9rem + 0.3vw);
    padding: 0.5rem;
    width: 100%;
}

.form-control:focus {
    border-color: #e67e22;
    box-shadow: 0 0 8px rgba(230, 126, 34, 0.3);
    outline: none;
}

.password-container {
    position: relative;
}

.password-container .form-control {
    padding-right: 2.5rem; /* add space for the eye icon */
}

.password-container .toggle-password {
    position: absolute;
    top: 70%;
    right: 10px; /* closer to edge */
    transform: translateY(-50%);
    cursor: pointer;
    color: #6b7280;
    transition: color 0.3s ease;
    font-size: 1.2rem;
    line-height: 1;
}

.password-container .toggle-password:hover {
    color: #2563eb;
}

.form-label {
    font-weight: 600;
    color: #374151;
    display: block;
    text-align: left;
    margin-bottom: 0.3rem;
}

/* ==========================================================================
   Card & Table
   ========================================================================== */

.card-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.table th {
    background-color: #2c3e50;
    color: white;
    font-weight: 500;
    padding: 0.75rem;
    font-size: calc(0.9rem + 0.2vw);
}

.table td {
    vertical-align: middle;
    padding: 0.75rem;
    font-size: calc(0.85rem + 0.2vw);
}

.alert {
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: calc(0.85rem + 0.2vw);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */

.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: url('https://images.unsplash.com/photo-1503387762-592deb58ef4e?q=80&w=1931&auto=format&fit=crop') no-repeat center center/cover;
    position: relative;
    color: white;
}

.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.hero-content {
    z-index: 2;
    padding: 1.5rem;
}

/* ==========================================================================
   Navbar
   ========================================================================== */

.navbar-custom {
    background: linear-gradient(90deg, #1d4ed8, #2563eb, #3b82f6);
    font-family: 'Poppins', sans-serif;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.8rem 1rem;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.navbar-custom .navbar-brand h2 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin: 0;
    transition: color 0.3s ease;
    color: #fff;
}
.navbar-custom .navbar-brand h2:hover {
    color: #fbbf24;
}

.navbar-custom .nav-link {
    color: #f8fafc;
    font-size: 1.05rem;
    font-weight: 600;
    margin-left: 20px;
    position: relative;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}
.navbar-custom .nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 0%;
    height: 3px;
    background: #fbbf24;
    transition: width 0.3s ease;
    border-radius: 2px;
}
.navbar-custom .nav-link:hover::after,
.navbar-custom .nav-link.active::after {
    width: 100%;
}
.navbar-custom .nav-link:hover {
    color: #fbbf24;
}

.navbar-custom .navbar-toggler {
    border: none;
    background-color: #fbbf24;
    padding: 6px 10px;
    border-radius: 6px;
}
.navbar-custom .navbar-toggler-icon {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='white' stroke-width='3' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Login Page
   ========================================================================== */

.login-container {
    background: #ffffff;
    border-radius: 20px;
    padding: 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    text-align: center;
    position: relative;
}
.login-container::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 6px;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    border-radius: 3px;
}
.login-container form {
    margin-top: 1rem;
}
.login-container .btn {
    width: auto;
    font-size: 1rem;
    font-weight: 600;
    background: #2563eb;
    color: white;
    border: none;
    transition: background 0.3s ease;
}
.login-container .btn:hover {
    background: #1e40af;
}
.login-container .forgot-password {
    display: block;
    margin-top: 0.8rem;
    font-size: 0.9rem;
    color: #2563eb;
    text-decoration: none;
    transition: color 0.3s ease;
}
.login-container .forgot-password:hover {
    color: #1e40af;
    text-decoration: underline;
}
.login-container .register-link {
    margin-top: 1.2rem;
    font-size: 0.9rem;
    color: #6b7280;
}
.login-container .register-link a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

/* Heading */
.login-container h2 {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1.2rem;
    font-size: 1.5rem;
}
.login-container h2::after {
    content: "";
    display: block;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    margin: 10px auto 0;
    border-radius: 2px;
}
.login-container h2:hover::after {
    width: 70px;
    transition: width 0.3s ease;
}
.login-container h2:focus::after {
    width: 70px;
    transition: width 0.3s ease;
}
.login-container h2:active::after {
    width: 70px;
    transition: width 0.3s ease;
}
.login-container h2:visited::after {
    width: 70px;
    transition: width 0.3s ease;
}
.login-container h2:link::after {
    width: 70px;
    transition: width 0.3s ease;
}
.login-container h2:target::after {
    width: 70px;
    transition: width 0.3s ease;
}
.login-container h2:focus-within::after {
    width: 70px;
    transition: width 0.3s ease;
}
.login-container h2:hover {
    color: #2563eb;
    transition: color 0.3s ease;
}

/* Labels */
.form-label {
    font-weight: 500;
    color: #374151;
    display: block;
    text-align: left;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
}
.login-container .form-label:hover {
    color: #2563eb;
    transition: color 0.3s ease;
}
.login-container .form-label:focus {
    color: #2563eb;
    transition: color 0.3s ease;
}
.login-container .form-label:active {
    color: #2563eb;
    transition: color 0.3s ease;
}

/* Input fields */
.form-control {
    border-radius: 8px;
    border: 1px solid #d1d5db;
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
    width: 100%;
    transition: border-color 0.2s ease;
}
.form-control:focus {
    border-color: #2563eb;
    outline: none;
}

/* Buttons */
.btn {
    padding: 0.7rem 1.2rem;
}

/* Wrapper for the login section */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
    padding: 2rem;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}

/* ==========================================================================
   Materials Showcase - Horizontal Scroll
   ========================================================================== */

.materials-showcase h3 {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    color: #2563eb;
    font-size: 2.2rem;
    margin-bottom: 2.5rem;
    text-align: center;
    letter-spacing: 1px;
    text-shadow: 0 3px 10px rgba(37, 99, 235, 0.25);
    position: relative;
}

.materials-showcase h3::after {
    content: "";
    display: block;
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #2563eb, #3b82f6, #60a5fa);
    margin: 12px auto 0;
    border-radius: 4px;
}

/* === Horizontal Scroll Container === */
.scroll-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 30px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 20px;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
}

/* Custom Scrollbar */
.scroll-container::-webkit-scrollbar {
    height: 8px;
}
.scroll-container::-webkit-scrollbar-thumb {
    background: #2563eb;
    border-radius: 4px;
}
.scroll-container::-webkit-scrollbar-track {
    background: #e0f2fe;
}

/* ==========================================================================
   Materials Showcase - Fit to Width (No Scroll)
   ========================================================================== */

.materials-showcase h3 {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    color: #2563eb;
    font-size: 2.2rem;
    margin-bottom: 2.5rem;
    text-align: center;
    letter-spacing: 1px;
    text-shadow: 0 3px 10px rgba(37, 99, 235, 0.25);
    position: relative;
}

.materials-showcase h3::after {
    content: "";
    display: block;
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #2563eb, #3b82f6, #60a5fa);
    margin: 12px auto 0;
    border-radius: 4px;
}

/* === Responsive Grid Layout === */
.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ==========================================================================
   Materials Showcase – Always Fit to Width
   ========================================================================== */

.materials-showcase h3 {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    color: #2563eb;
    font-size: 2.2rem;
    margin-bottom: 2.5rem;
    text-align: center;
    letter-spacing: 1px;
    text-shadow: 0 3px 10px rgba(37, 99, 235, 0.25);
    position: relative;
}

.materials-showcase h3::after {
    content: "";
    display: block;
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #2563eb, #3b82f6, #60a5fa);
    margin: 12px auto 0;
    border-radius: 4px;
}

/* === Always-fit Grid === */
.materials-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 5 equal columns on large screens */
    gap: 30px;
    width: 100%;
    padding: 20px;
    margin: 0 auto;
}

/* Responsive breakpoints so cards never overflow */
@media (max-width: 1200px) {
    .materials-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 992px) {
    .materials-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .materials-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .materials-grid { grid-template-columns: 1fr; }
}

/* === Material Card === */
.material-card {
    background: linear-gradient(135deg, #f8fbff, #e0f2fe);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease;
    font-family: 'Quicksand', sans-serif;
    cursor: pointer;
    position: relative;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.material-card:hover {
    transform: translateY(-10px) scale(1.03);
    box-shadow: 0 18px 35px rgba(37, 99, 235, 0.25);
    border-color: #2563eb;
}

.material-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.material-card:hover img {
    transform: scale(1.08) rotate(1deg);
}

.material-info {
    padding: 1.2rem;
    text-align: center;
    background: #ffffff;
}

.material-info p {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: #1d4ed8;
}

.material-info span {
    display: block;
    margin-top: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #475569;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
    background: linear-gradient(90deg, #1a3c5e, #2a6e9e);
    color: white;
    padding: 1.5rem 0;
    text-align: center;
    font-size: calc(0.8rem + 0.2vw);
    box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.2);
}

.footer a {
    color: #f8d210;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #ffffff;
    text-decoration: underline;
}

.footer p {
    margin: 0.5rem 0;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes glow {
    0% { box-shadow: 0 0 10px rgba(37, 99, 235, 0.2); }
    50% { box-shadow: 0 0 22px rgba(37, 99, 235, 0.4); }
    100% { box-shadow: 0 0 10px rgba(37, 99, 235, 0.2); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(25px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes rotateGlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Media Queries (Consolidated and simplified)
   ========================================================================== */

@media (max-width: 768px) {
    body {
        font-size: calc(12px + 0.5vw);
        padding-top: 60px; /* Adjust padding for smaller screens */
    }

    .container {
        padding: 0.5rem;
    }

    h1 { font-size: calc(1.5rem + 1vw); }
    h2 { font-size: calc(1.2rem + 0.8vw); }
    h4 { font-size: calc(1rem + 0.5vw); }

    .btn-custom {
        padding: 0.6rem 1.2rem;
        font-size: calc(0.8rem + 0.3vw);
        min-width: 120px;
    }

    .form-control {
        font-size: calc(0.8rem + 0.3vw);
        padding: 0.4rem;
    }

    .card-container {
        padding: 1rem;
    }

    .hero-content {
        padding: 1rem;
    }

    .hero-content h1 {
        font-size: calc(1.5rem + 0.8vw);
    }

    .materials-showcase h3 {
        font-size: 1.8rem;
    }

    .material-card img {
        height: 160px;
    }

    .login-container {
        margin-top: 1rem;
        padding: 1rem;
    }

    .d-flex.gap-3 {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (min-width: 769px) {
    .container {
        padding: 0.5rem;
    }
}