/* ===================================================
   ENSA Connect - Global Styles
=================================================== */

/* ==========================
   RESET
========================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==========================
   COLORS
========================== */

:root {
    --primary: #6082B6;
    --primary-hover: #6082B6;
    --primary-dark: #0F172A;
    --background: #F8FAFC;
    --white: #FFFFFF;
    --text: #1E293B;
    --text-light: #64748B;
    --border: #E2E8F0;
}

/* ==========================
   BODY
========================== */

body {
    font-family: 'Poppins', sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
}

/* ==========================
   CONTAINER
========================== */

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* ==========================
   LINKS
========================== */

a {
    text-decoration: none;
    color: var(--primary);
    transition: .3s;
}
a:hover {
    color: var(--primary-hover);
}

/* ==========================
   BUTTONS
========================== */

button,
.btn {
    display: inline-block;
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: .3s;
}
button:hover,
.btn:hover {
    background: var(--primary-hover);
    color: white;
}

/* ==========================
   NAVBAR
========================== */

.navbar {
    background: var(--primary-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 60px;
}

.logo {
    display: flex;
    align-items: center;
}
.logo img {
    height: 95px;
    width: auto;
    display: block;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
}
.nav-links a {
    color: white;
    font-weight: 500;
    transition: .3s;
}
.nav-links a:hover {
    color: #BFDBFE;
}
.nav-links a.active {
    border-bottom: 2px solid white;
    padding-bottom: 5px;
}

/* ==========================
   FORMS
========================== */

form {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .05);
}
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text);
}
input,
select,
textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: .3s;
}
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
textarea {
    resize: vertical;
}

/* ==========================
   TITLES
========================== */

h1,
h2,
h3 {
    color: var(--text);
}

/* ==========================
   FOOTER
========================== */

footer {
    background: var(--primary-dark);
    color: white;
    text-align: center;
    padding: 30px 20px;
}
footer p {
    color: #CBD5E1;
}

/* ==========================
   RESPONSIVE NAVBAR
========================== */

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 18px;
    }
}

/* ==========================
   USER SECTION
========================== */

.user {
    display: flex;
    align-items: center;
    gap: 18px;
}
.user a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-weight: 500;
    transition: .3s;
    padding: 6px 12px;
    border-radius: 8px;
}
.user a:hover {
    color: #BFDBFE;
    background: rgba(255, 255, 255, 0.08);
}
.user a i {
    font-size: 16px;
}

/* ==========================
   NOTIFICATION BELL
========================== */

.notification-btn {
    position: relative;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.notification-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #BFDBFE;
}
.notification-btn:active {
    transform: scale(0.92);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -2px;
    background: #EF4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    transition: transform 0.2s ease;
}
.notification-btn:hover .notification-badge {
    transform: scale(1.1);
}
.notification-badge.hidden {
    display: none;
}

/* ==========================
   THEME TOGGLE BUTTON
========================== */

.theme-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #BFDBFE;
}
.theme-toggle:active {
    transform: scale(0.92);
}

/* ==========================
   NOTIFICATION DROPDOWN
========================== */

.notification-dropdown {
    display: none;
    position: absolute;
    top: 55px;
    right: 0;
    width: 380px;
    max-height: 420px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    overflow: hidden;
    z-index: 1000;
    animation: dropdownSlide 0.25s ease;
}
.notification-dropdown.open {
    display: block;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.dropdown-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}
.dropdown-header .mark-all-read {
    font-size: 12px;
    color: var(--primary);
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    transition: 0.3s;
}
.dropdown-header .mark-all-read:hover {
    background: rgba(96, 130, 182, 0.1);
}

.notification-list {
    max-height: 330px;
    overflow-y: auto;
    padding: 4px 0;
}
.notification-list::-webkit-scrollbar {
    width: 4px;
}
.notification-list::-webkit-scrollbar-track {
    background: var(--background);
}
.notification-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 20px;
    transition: 0.2s;
    cursor: pointer;
    border-bottom: 1px solid #F1F5F9;
}
.notification-item:last-child {
    border-bottom: none;
}
.notification-item:hover {
    background: #F8FAFC;
}
.notification-item.unread {
    background: #EFF6FF;
}
.notification-item.unread:hover {
    background: #DBEAFE;
}

.notification-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
    background: var(--primary);
}
.notification-icon.housing {
    background: #3B82F6;
}
.notification-icon.event {
    background: #8B5CF6;
}
.notification-icon.career {
    background: #10B981;
}
.notification-icon.rent {
    background: #F59E0B;
}

.notification-content {
    flex: 1;
    min-width: 0;
}
.notification-content .message {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 2px;
    line-height: 1.4;
}
.notification-content .time {
    font-size: 12px;
    color: var(--text-light);
}

.unread-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    background: #3B82F6;
    border-radius: 50%;
    margin-top: 6px;
}

.empty-notifications {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}
.empty-notifications i {
    font-size: 40px;
    color: var(--border);
    margin-bottom: 12px;
    display: block;
}
.empty-notifications p {
    font-size: 14px;
    margin: 0;
}

/* ==========================
   RESPONSIVE
========================== */

@media (max-width: 768px) {
    .user {
        gap: 12px;
    }
    .notification-btn {
        font-size: 18px;
        padding: 4px 8px;
    }
    .notification-badge {
        width: 16px;
        height: 16px;
        font-size: 9px;
        top: -3px;
        right: -1px;
    }
    .user a {
        font-size: 14px;
        padding: 4px 8px;
    }
    .notification-dropdown {
        width: 92vw;
        right: -10px;
        max-height: 360px;
    }
    .notification-item {
        padding: 12px 16px;
    }
    .notification-content .message {
        font-size: 13px;
    }
}

/* ===================================================
   DARK THEME - TARGETING html.dark-theme
=================================================== */

html.dark-theme {
    --primary: #6082B6;
    --primary-hover: #7A9BC9;
    --primary-dark: #0B1120;
    --background: #0F172A;
    --white: #1E293B;
    --text: #F1F5F9;
    --text-light: #94A3B8;
    --border: #334155;
}

html.dark-theme body {
    background: #0F172A;
    color: #F1F5F9;
}

/* ---- Navbar ---- */
html.dark-theme .navbar {
    background: #0B1120;
}

/* ---- Cards ---- */
html.dark-theme .card {
    background: #1E293B;
    border-color: #334155;
}
html.dark-theme .card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* ---- Forms ---- */
html.dark-theme form {
    background: #1E293B;
    border-color: #334155;
}
html.dark-theme input,
html.dark-theme select,
html.dark-theme textarea {
    background: #0F172A;
    border-color: #334155;
    color: #F1F5F9;
}
html.dark-theme input:focus,
html.dark-theme select:focus,
html.dark-theme textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(96, 130, 182, 0.2);
}
html.dark-theme input::placeholder,
html.dark-theme textarea::placeholder {
    color: #64748B;
}

/* ---- Hero ---- */
html.dark-theme .hero h1 {
    color: #F1F5F9;
}

/* ---- Search Section ---- */
html.dark-theme .search-section {
    background: #1E293B;
    border-color: #334155;
}

/* ---- Housing Grid ---- */
html.dark-theme .housing-grid .card {
    background: #1E293B;
    border-color: #334155;
}
html.dark-theme .housing-grid .card h3 {
    color: #F1F5F9;
}
html.dark-theme .housing-grid .card p {
    color: #94A3B8;
}
html.dark-theme .housing-grid .card .btn {
    background: var(--primary);
}
html.dark-theme .housing-grid .card .btn:hover {
    background: var(--primary-hover);
}

/* ---- Housing Details ---- */
html.dark-theme .housing-info .card {
    background: #1E293B;
    border-color: #334155;
}
html.dark-theme .housing-info .card h3 {
    color: #94A3B8;
}
html.dark-theme .housing-info .card p {
    color: #F1F5F9;
}
html.dark-theme .description .card,
html.dark-theme .roommate .card,
html.dark-theme .owner .card {
    background: #1E293B;
    border-color: #334155;
}
html.dark-theme .description .card p,
html.dark-theme .roommate .card p,
html.dark-theme .owner .card p {
    color: #E2E8F0;
}
html.dark-theme .btn-outline {
    border-color: var(--primary);
    color: var(--primary);
}
html.dark-theme .btn-outline:hover {
    background: var(--primary);
    color: white;
}

/* ---- Clubs Page ---- */
html.dark-theme .clubs-list {
    background: #1E293B;
}
html.dark-theme .club-card {
    background: #0F172A;
    border-color: #334155;
}
html.dark-theme .club-card h3 {
    color: #F1F5F9;
}
html.dark-theme .club-description {
    color: #94A3B8;
}
html.dark-theme .club-category {
    background: #1E293B;
    color: var(--primary);
}
html.dark-theme .club-members {
    color: #94A3B8;
}
html.dark-theme .club-event-header {
    background: #1E293B;
    border-color: #334155;
}
html.dark-theme .club-event-header h1 {
    color: #F1F5F9;
}
html.dark-theme .club-event-header p {
    color: #94A3B8;
}

/* ---- Events Page ---- */
html.dark-theme .event-card {
    background: #1E293B;
    border-color: #334155;
}
html.dark-theme .event-content h3 {
    color: #F1F5F9;
}
html.dark-theme .event-description {
    color: #E2E8F0;
}
html.dark-theme .event-meta p {
    color: #94A3B8;
}
html.dark-theme .event-gallery h4 {
    color: #F1F5F9;
}
html.dark-theme .gallery-thumbs img {
    border-color: #334155;
}
html.dark-theme .gallery-link {
    color: var(--primary);
}

/* ---- Profile Page ---- */
html.dark-theme .profile-header h1 {
    color: #F1F5F9;
}
html.dark-theme .profile-header p {
    color: #94A3B8;
}
html.dark-theme .profile-avatar {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}
html.dark-theme .profile-form h2 {
    color: #F1F5F9;
}
html.dark-theme .my-posts {
    background: #1E293B;
}
/* ---- Housing List & Details headings (missed previously) ---- */
html.dark-theme .housing-list h2,
html.dark-theme .housing-header h1,
html.dark-theme .description h2,
html.dark-theme .roommate h2,
html.dark-theme .owner h2 {
    color: #F1F5F9;
}

/* ---- Events List heading (missed previously) ---- */
html.dark-theme .events-list h2 {
    color: #F1F5F9;
}

html.dark-theme .my-posts h2 {
    color: #F1F5F9;
}
html.dark-theme .posts-grid .card {
    background: #0F172A;
    border-color: #334155;
}
html.dark-theme .posts-grid .card h3 {
    color: #F1F5F9;
}
html.dark-theme .posts-grid .card p {
    color: #94A3B8;
}
html.dark-theme .profile-actions h2 {
    color: #F1F5F9;
}

/* ---- Change Password ---- */
html.dark-theme .page-header h1 {
    color: #F1F5F9;
}
html.dark-theme .page-header p {
    color: #94A3B8;
}
html.dark-theme .form-section form {
    background: #1E293B;
    border-color: #334155;
}
html.dark-theme .form-section form label {
    color: #F1F5F9;
}
html.dark-theme .form-section form input {
    background: #0F172A;
    border-color: #334155;
    color: #F1F5F9;
}
html.dark-theme .form-section form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(96, 130, 182, 0.2);
}
html.dark-theme .password-hint {
    color: #94A3B8;
}
html.dark-theme .strength-text {
    color: #94A3B8;
}

/* ---- Notification Dropdown ---- */
html.dark-theme .notification-dropdown {
    background: #1E293B;
    border-color: #334155;
}
html.dark-theme .dropdown-header {
    border-color: #334155;
}
html.dark-theme .dropdown-header h3 {
    color: #F1F5F9;
}
html.dark-theme .notification-item {
    border-color: #334155;
}
html.dark-theme .notification-item:hover {
    background: #0F172A;
}
html.dark-theme .notification-item.unread {
    background: #1A2744;
}
html.dark-theme .notification-item.unread:hover {
    background: #1E2D4A;
}
html.dark-theme .notification-content .message {
    color: #F1F5F9;
}
html.dark-theme .notification-content .time {
    color: #94A3B8;
}
html.dark-theme .empty-notifications {
    color: #94A3B8;
}

/* ---- Footer ---- */
html.dark-theme footer {
    background: #0B1120;
}
html.dark-theme footer p {
    color: #94A3B8;
}

/* ---- Back Links ---- */
html.dark-theme .back-link a {
    color: #94A3B8;
}
html.dark-theme .back-link a:hover {
    color: var(--primary);
}

/* ---- Career Details ---- */
html.dark-theme .career-detail-header h1 {
    color: #F1F5F9;
}
html.dark-theme .detail-meta p {
    color: #94A3B8;
}
html.dark-theme .detail-section h2 {
    color: #F1F5F9;
}
html.dark-theme .detail-section .card {
    background: #1E293B;
    border-color: #334155;
}
html.dark-theme .detail-section .card p,
html.dark-theme .detail-section .card li {
    color: #E2E8F0;
}
html.dark-theme .attachment-link {
    background: #0F172A;
    border-color: #334155;
    color: var(--primary);
}
html.dark-theme .attachment-link:hover {
    background: #1E293B;
}
html.dark-theme .author-card {
    background: #1E293B;
    border-color: #334155;
}
html.dark-theme .author-info .author-name {
    color: #F1F5F9;
}
html.dark-theme .author-info .author-major {
    color: #94A3B8;
}
html.dark-theme .author-info .author-year {
    color: #94A3B8;
}

/* ---- Career Cards ---- */
html.dark-theme .career-card {
    background: #1E293B;
    border-color: #334155;
}
html.dark-theme .career-card:hover {
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.3);
}

/* ===================================================
   THEME TRANSITION - SMOOTH SWITCHING
=================================================== */

html.dark-theme,
html.dark-theme body,
html.dark-theme * {
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ==========================================
   PAGE TRANSITION
========================================== */

body {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   TOAST NOTIFICATIONS
============================================ */

.custom-toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 16px 24px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 15px;
    z-index: 99999;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    animation: toastSlideDown 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 90%;
    min-width: 280px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-toast.success {
    background: #16A34A;
    color: white;
    border-color: #22C55E;
}

.custom-toast.error {
    background: #DC2626;
    color: white;
    border-color: #EF4444;
}

.custom-toast .toast-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.custom-toast .toast-message {
    flex: 1;
    line-height: 1.4;
}

.custom-toast .toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    transition: 0.2s;
    line-height: 1;
}

.custom-toast .toast-close:hover {
    color: white;
    transform: scale(1.2);
}

.custom-toast.toast-hide {
    animation: toastSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastSlideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

@keyframes toastSlideUp {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-30px) scale(0.95);
    }
}

/* Dark theme support for toast */
html.dark-theme .custom-toast {
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

html.dark-theme .custom-toast.success {
    background: #15803D;
}

html.dark-theme .custom-toast.error {
    background: #B91C1C;
}

/* Mobile toast */
@media (max-width: 600px) {
    .custom-toast {
        top: 20px;
        padding: 14px 18px;
        font-size: 14px;
        min-width: unset;
        width: calc(100% - 40px);
        border-radius: 10px;
    }
    
    .custom-toast .toast-icon {
        font-size: 18px;
    }
}

/* ============================================
   LOGOUT MODAL
============================================ */

.logout-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    animation: modalFadeIn 0.3s ease;
    padding: 20px;
}

.logout-modal-overlay.modal-hide {
    animation: modalFadeOut 0.3s ease forwards;
}

.logout-modal {
    background: var(--white);
    border-radius: 16px;
    padding: 40px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    animation: modalSlideUp 0.3s ease;
}

.logout-modal-overlay.modal-hide .logout-modal {
    animation: modalSlideDown 0.3s ease forwards;
}

.modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #FEE2E2;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 16px;
    font-size: 24px;
    color: #DC2626;
}

.logout-modal h2 {
    font-size: 1.4rem;
    color: var(--text);
    margin-bottom: 8px;
}

.logout-modal p {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.6;
}

.logout-modal .modal-subtext {
    font-size: 13px;
    opacity: 0.7;
    margin-top: 4px;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s ease;
    font-family: inherit;
}

.cancel-btn {
    background: var(--border);
    color: var(--text);
}

.cancel-btn:hover {
    background: var(--text-light);
    color: white;
}

.confirm-btn {
    background: #DC2626;
    color: white;
}

.confirm-btn:hover {
    background: #B91C1C;
}

/* Modal animations */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modalSlideDown {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
}

/* Dark theme for modal */
html.dark-theme .logout-modal {
    background: #1E293B;
}

html.dark-theme .logout-modal h2 {
    color: #F1F5F9;
}

html.dark-theme .logout-modal p {
    color: #94A3B8;
}

html.dark-theme .cancel-btn {
    background: #334155;
    color: #F1F5F9;
}

html.dark-theme .cancel-btn:hover {
    background: #475569;
}

/* Mobile modal */
@media (max-width: 500px) {
    .logout-modal {
        padding: 30px 24px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

.nav-profile-pic {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.5);
}
/* Cancel button dark mode fix */
html.dark-theme #cancelBtn {
    background: #334155;
    color: #F1F5F9;
    border: 1px solid #475569;
}

html.dark-theme #cancelBtn:hover {
    background: #475569;
    color: white;
}