:root {
    --primary-black: #1a1a1a;
    --secondary-dark: #333333;
    --accent-gray: #666666;
    --light-gray: #f4f4f4;
    --border-color: #dddddd;
    --text-main: #111111;
    --text-muted: #555555;
    --white: #ffffff;
    --success: #2e7d32;
    --error: #c62828;
}

* { box-sizing: border-box; }

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--light-gray);
    color: var(--text-main);
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
}

header {
    background-color: var(--primary-black);
    padding: 1rem 1.5rem;
    color: var(--white);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 2000;
    width: 100%;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    position: relative;
}

.brand {
    display: flex;
    align-items: center;
    max-width: 70%;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--white);
    gap: 8px;
    max-width: 100%;
}

.header-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.logo-text {
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.8rem;
}

.nav-links a {
    color: var(--white);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover { color: #d1d1d1; }

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background: none;
    color: var(--white);
    border: none;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.dropbtn:hover { color: #d1d1d1; }

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--white);
    min-width: 220px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    z-index: 100;
    border-radius: 8px;
    top: 100%;
    right: 0;
    border: 1px solid var(--border-color);
    margin-top: 10px;
    animation: fadeIn 0.2s ease;
}

/* Bridging the gap for smoother hover */
.dropdown::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 15px;
    background: transparent;
    display: none;
}

.dropdown:hover::after {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-content a {
    color: var(--text-main);
    padding: 14px 20px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--light-gray);
    font-weight: 600;
}

.dropdown-content a:last-child { border-bottom: none; }
.dropdown-content a:hover { background-color: var(--light-gray); color: var(--primary-black); }
.text-danger { color: var(--error) !important; }

.dropdown:hover .dropdown-content { display: block; }

/* Auth Buttons */
.auth-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 700;
    transition: all 0.2s;
    text-align: center;
}

.btn-login { border: 1px solid var(--white); color: var(--white); }
.btn-login:hover { background: rgba(255,255,255,0.15); color: var(--white); }
.btn-register { background: var(--white); color: var(--primary-black) !important; }
.btn-register:hover { background: #e0e0e0; }

/* Notification Bell */
.notification-bell-container {
    position: relative;
    display: flex;
    align-items: center;
}

.notification-bell {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.6rem;
    display: flex;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    border-radius: 50%;
}

.notification-bell:hover { 
    color: #ffffff; 
    transform: scale(1.15);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.notification-bell:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
}

.notification-bell.shake {
    animation: bell-shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes bell-shake {
    0%, 100% { transform: rotate(0); }
    15% { transform: rotate(20deg); }
    30% { transform: rotate(-15deg); }
    45% { transform: rotate(10deg); }
    60% { transform: rotate(-5deg); }
}

.notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: #ff3b30;
    color: white;
    font-size: 10px;
    font-weight: 900;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border: 2px solid var(--primary-black);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 2;
}

.notification-badge.pulse {
    animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(255, 59, 48, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); }
}

.notification-dropdown {
    display: none;
    position: absolute;
    background-color: var(--white);
    width: 320px;
    max-height: 450px;
    overflow-y: auto;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    z-index: 2500;
    border-radius: 12px;
    top: calc(100% + 15px);
    right: -10px;
    border: 1px solid var(--border-color);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.notification-dropdown.active { display: block; }

.notification-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.notification-header h5 { margin: 0; font-weight: 800; color: var(--primary-black); }

.notification-item {
    display: block;
    padding: 15px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
    position: relative;
}

.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background: #f0f7ff; }

.notification-item.unread {
    background: #f4f9ff;
    border-left: 4px solid #007bff;
}

.notif-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #111;
}

.notif-body {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.4;
    margin-bottom: 5px;
    display: block;
}

.notif-time {
    font-size: 0.75rem;
    color: #999;
    display: block;
    margin-top: 6px;
}

.no-notifications {
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-size: 0.95rem;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.mobile-menu-toggle span {
    display: block;
    width: 28px;
    height: 3px;
    background-color: var(--white);
    transition: 0.3s;
    border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) { transform: rotate(-45deg) translate(-6px, 6px); }
.mobile-menu-toggle.active span:nth-child(2) { opacity: 0; }
.mobile-menu-toggle.active span:nth-child(3) { transform: rotate(45deg) translate(-6px, -6px); }

/* Main Container */
.container {
    flex: 1;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    width: 100%;
}

.flash-messages { margin-bottom: 1.5rem; }

.alert {
    padding: 1rem 1.5rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 0.95rem;
    border-left: 5px solid transparent;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    width: 100%;
}

.alert-success { background: #e8f5e9; color: #2e7d32; border-left-color: #2e7d32; }
.alert-error { background: #ffebee; color: #c62828; border-left-color: #c62828; }
.alert-info { background: #e3f2fd; color: #0277bd; border-left-color: #0277bd; }

.card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    width: 100%;
    word-wrap: break-word;
}

@media (min-width: 768px) {
    .card { padding: 2.5rem; }
    .container { margin: 3rem auto; padding: 0 1.5rem; }
}

/* Footer */
footer {
    background: var(--primary-black);
    color: var(--white);
    padding: 3rem 1.5rem 2rem;
    margin-top: auto;
    width: 100%;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2.5rem;
    margin-bottom: 2.5rem;
}

.footer-section h4 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    color: var(--white);
    letter-spacing: -0.5px;
}

.footer-section p {
    color: #a0a0a0;
    font-size: 0.95rem;
    line-height: 1.7;
}

.footer-section a {
    display: block;
    color: #a0a0a0;
    text-decoration: none;
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
    transition: color 0.2s;
    font-weight: 500;
}

.footer-section a:hover { color: var(--white); }

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-bottom p {
    margin: 0;
    color: #a0a0a0;
    font-size: 0.9rem;
}

.made-by {
    font-weight: 600;
}

.made-by a {
    color: var(--white);
    font-weight: 800;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s;
    letter-spacing: 0.5px;
}

.made-by a:hover {
    border-bottom-color: var(--white);
}

/* Global Buttons */
.btn {
    display: inline-block;
    padding: 0.8rem 1.8rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-align: center;
    max-width: 100%;
}

.btn-primary { background: var(--primary-black); color: var(--white); }
.btn-primary:hover { background: var(--secondary-dark); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.btn-secondary { background: var(--white); color: var(--primary-black); border: 2px solid var(--primary-black); }
.btn-secondary:hover { background: var(--light-gray); }

/* Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin: 1.5rem 0;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

table { 
    width: 100%; 
    border-collapse: collapse;
    margin: 0;
    min-width: 500px;
}

th { 
    padding: 1rem 0.8rem; 
    background: #f8f9fa;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
}

td { 
    padding: 1rem 0.8rem; 
    border-bottom: 1px solid var(--border-color); 
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background-color: #fafafa; }

/* Badges */
.badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
}

.bg-success { background: #e8f5e9; color: #2e7d32; }
.bg-danger { background: #ffebee; color: #c62828; }
.bg-warning { background: #fff8e1; color: #f57f17; }

/* Media Queries for full responsiveness */
@media (max-width: 850px) {
    header { padding: 1rem; }
    
    .mobile-menu-toggle { display: flex; }

    .nav-links {
        display: none;
        flex-direction: column;
        position: fixed;
        top: 60px; /* Header height */
        left: 0;
        right: 0;
        bottom: 0;
        background-color: var(--primary-black);
        padding: 2rem 1.5rem;
        gap: 1.5rem;
        z-index: 1000;
        align-items: stretch;
        border-top: 1px solid rgba(255,255,255,0.1);
        overflow-y: auto;
    }

    .nav-links.active { display: flex; }

    .dropdown { width: 100%; }
    .dropbtn { width: 100%; justify-content: space-between; padding: 0.8rem 0; font-size: 1.1rem; }

    .dropdown-content {
        position: static;
        display: none;
        width: 100%;
        box-shadow: none;
        border: none;
        background-color: rgba(255,255,255,0.05);
        margin-top: 0.5rem;
        border-radius: 4px;
        max-height: none;
    }

    .dropdown:hover .dropdown-content { display: none; } /* Disable hover on mobile */
    .dropdown.active .dropdown-content { display: block; }
    
    .dropdown-content a {
        color: var(--white);
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding: 12px 16px;
    }
    
    .dropdown-content a:hover { background-color: rgba(255,255,255,0.1); color: var(--white); }

    .auth-buttons {
        flex-direction: column;
        width: 100%;
        gap: 1rem;
        margin-top: 1rem;
        padding-top: 1.5rem;
        border-top: 1px solid rgba(255,255,255,0.1);
    }

    .nav-btn { width: 100%; text-align: center; font-size: 1.1rem; padding: 1rem; }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
        justify-content: center;
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .logo-text { font-size: 1.1rem; }
    .header-logo { height: 32px; }
    .container { margin: 1rem auto; padding: 0 0.8rem; }
    .card { padding: 1.25rem; }
    .btn { width: 100%; }
}

/* Chat Notification Popup */
.chat-notification-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    left: 20px;
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 10000;
    max-width: 350px;
    border-left: 5px solid #007bff;
    transition: all 0.5s ease;
    animation: slideInRight 0.5s ease-out;
}

@media (min-width: 480px) {
    .chat-notification-popup {
        left: auto;
        min-width: 280px;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* PWA Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1a1a1a;
    color: white;
    padding: 1.25rem 1.5rem;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: space-between;
    z-index: 10001;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    animation: pwaSlideUp 0.4s ease-out;
}

.pwa-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.pwa-logo {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    object-fit: cover;
}

.pwa-text h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.pwa-text p {
    margin: 2px 0 0;
    font-size: 0.85rem;
    color: #bbb;
}

.pwa-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pwa-install-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.pwa-install-btn:hover {
    background: #0056b3;
}

.pwa-close-btn {
    background: transparent;
    color: #999;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    transition: color 0.2s;
}

.pwa-close-btn:hover {
    color: white;
}

@keyframes pwaSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@media (max-width: 480px) {
    .pwa-install-banner {
        padding: 1rem;
    }
    .pwa-text p {
        display: none;
    }
}
