/* public/CSS/common.css */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;700&display=swap');

:root {
    --primary-color: #000000; /* Black */
    --secondary-color: #FFD700; /* Gold */
    --background-color: #000000; /* Black */
    --card-bg-color: #1a1a1a; /* Dark gray for cards */
    --text-color: #ffffff; /* White */
    --heading-color: #FFD700; /* Gold */
    --border-color: #333333; /* Dark gray border */
    --success-color: #4CAF50; /* Green */
    --pending-color: #FFC107; /* Yellow */
    --error-color: #f44336; /* Red */
    --menu-button-color: #fff; /* White for the menu button */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    direction: ltr;
    text-align: left;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.card {
    background-color: var(--card-bg-color);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8s 30px rgba(0, 0, 0, 0.8);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--heading-color);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5rem;
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group input, .input-group select {
    width: 100%;
    padding: 0.8rem 1rem;
    padding-left: 3rem; /* Adjusted padding to make space for the icon */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background-color: #222;
    color: #eee;
    transition: border-color 0.3s ease;
}

.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.2);
}

.input-group .icon {
    position: absolute;
    top: 50%;
    left: 1rem; /* Changed to left */
    transform: translateY(-50%);
    color: var(--secondary-color);
    z-index: 10; /* Added to ensure the icon is on top */
}

.btn {
    display: inline-block;
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.3s ease, transform 0.2s ease, color 0.3s ease;
}

.btn-login {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

.btn-login:hover {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    transform: translateY(-2px);
    border: 1px solid var(--secondary-color);
}

.btn-update, .btn-submit-task, .btn-approve {
    background-color: var(--success-color);
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-update:hover, .btn-submit-task:hover, .btn-approve:hover {
    background-color: #2e7d32;
    transform: translateY(-2px);
}

.btn-reset {
  background-color: var(--secondary-color);
  color: var(--primary-color);
}

.btn-reset:hover {
  background-color: var(--primary-color);
  color: var(--secondary-color);
  transform: translateY(-2px);
  border: 1px solid var(--secondary-color);
}

.btn-disabled {
  background-color: #333 !important;
  color: #666;
  cursor: not-allowed;
  transform: none !important;
}

.btn-secondary {
    background-color: transparent;
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 215, 0, 0.2);
    transform: translateY(-2px);
}

/* New: Logout Button */
.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-align: center;
    background-color: var(--card-bg-color); /* Updated background color */
    border: 1px solid var(--border-color); /* Added border */
    color: var(--text-color) !important;
    font-weight: 700;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease-in-out;
    border-radius: 8px;
}

.btn-logout i {
    font-size: 1.2rem;
    margin-right: 0.75rem;
    transition: color 0.3s ease;
}

.btn-logout:hover {
    color: var(--secondary-color) !important;
    background-color: rgba(255, 215, 0, 0.1) !important;
    border: 1px solid var(--secondary-color);
    transform: translateY(-2px);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

.btn-logout:hover i {
    color: var(--secondary-color) !important;
}

.btn-logout.loading {
    background-color: #222 !important;
    color: #666;
    cursor: not-allowed;
    transform: none;
    border-color: #444 !important;
}

.btn-logout.loading .btn-text,
.btn-logout.loading .fa-sign-out-alt {
    display: none;
}

.btn-logout .logout-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn-logout.loading .logout-spinner {
    display: block;
}


/* Mobile Menu Button */
.mobile-menu-btn {
    position: fixed;
    top: 1rem;
    right: 1rem; /* Changed from 'left' to 'right' */
    z-index: 101; /* Above sidebar */
    background: transparent;
    border: none;
    color: var(--menu-button-color);
    font-size: 1.8rem;
    cursor: pointer;
    display: none; /* Hide by default on large screens */
    padding: 0.5rem;
    transition: transform 0.3s ease-in-out;
}

.mobile-menu-btn:hover {
    transform: scale(1.1);
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

/* New: Loader styles */
.main-content-wrapper {
    flex-grow: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

.loader-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 90;
    background-color: var(--background-color);
    transition: opacity 0.3s ease;
}

.loader {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--secondary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Class to hide content initially */
.hidden-content {
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 0.5s, opacity 0.5s ease;
}

.visible-content {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.5s ease;
}

/* New: Modal styles for Logout Confirmation */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

/* New style for the notification dropdown modal */
.modal.dropdown-modal {
    background-color: transparent;
    backdrop-filter: none;
    justify-content: flex-end;
    align-items: flex-start;
    padding-top: 60px; /* Offset for the fixed navbar */
    padding-right: 2rem;
}

.modal-content {
    background-color: var(--card-bg-color);
    margin: auto;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    position: relative;
    display: flex;
    flex-direction: column;
    width: 90%;
    max-width: 1200px;
    min-height: 60vh;
    max-height: 90vh;
    transition: width 0.4s ease-in-out, height 0.4s ease-in-out, max-width 0.4s ease-in-out; /* Add transition for a smooth effect */
}

/* New style for dropdown modal content */
.modal.dropdown-modal .modal-content {
    width: 350px;
    max-width: 350px;
    min-height: auto;
    max-height: 500px;
    transition: transform 0.3s ease-out;
    transform-origin: top right;
    transform: scale(0.8) translateY(-20px);
    opacity: 0;
}

.modal.dropdown-modal.open .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Compact modal state for confirmation and spinner */
.modal-content.compact-state {
    max-width: 400px; /* Or a smaller value that fits the content */
    min-height: auto;
    max-height: auto;
    height: fit-content;
    width: fit-content;
}

.modal-header {
    padding: 1.5rem 2rem 1rem 2rem;
    border-bottom: 2px solid var(--secondary-color);
    flex-shrink: 0;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-btn {
    color: #aaa;
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 28px;
    font-weight: bold;
    z-index: 10;
}

.close-btn:hover,
.close-btn:focus {
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--heading-color);
    margin: 0;
    padding-right: 3rem;
}

/* Modal Body - Main scrollable area */
.modal-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1.5rem 2rem;
}

.modal-footer {
    padding: 1rem 2rem 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin: 0;
}

.modal-buttons .btn {
    flex-grow: 1;
    max-width: 200px;
}

/* NEW STYLES FOR NAVBAR AND NOTIFICATIONS */
.navbar {
    background-color: var(--card-bg-color);
    color: var(--text-color);
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: flex-end; /* Align to the right */
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    position: fixed;
    top: 0;
    width: calc(100% - 280px); /* Fill the space next to the sidebar */
    right: 0;
    z-index: 500;
}

@media (max-width: 768px) {
    .navbar {
        width: 100%;
        padding: 0.5rem 1rem;
    }
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-info h4 {
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
    color: var(--text-color);
}

.user-info span {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.notification-icon-container {
    position: relative;
    cursor: pointer;
    background-color: #333;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.notification-icon-container:hover {
    background-color: #555;
}

.notification-icon {
    font-size: 1.5rem;
    color: var(--secondary-color);
    transition: transform 0.3s ease;
}

.notification-icon:hover {
    transform: scale(1.1);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--error-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 50%;
    padding: 4px 6px;
    min-width: 20px;
    text-align: center;
    pointer-events: none;
}

/* NEW DROPDOWN STYLES */
.notification-dropdown {
    position: absolute;
    top: 60px; /* Adjust based on navbar height */
    right: 2rem;
    width: 350px;
    background-color: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 550;
    display: none;
    flex-direction: column;
    max-height: 500px;
    overflow-y: auto;
    transform-origin: top right;
    animation: fadeInScale 0.3s ease-out forwards;
}

.notification-dropdown.show {
    display: flex;
}

.dropdown-header {
    padding: 1rem 1.5rem;
    border-bottom: 2px solid var(--secondary-color);
    flex-shrink: 0;
}

.dropdown-header h4 {
    font-size: 1.2rem;
    margin: 0;
    color: var(--heading-color);
}

.notification-list {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
}

.notification-item {
    padding: 0.75rem 1rem;
    background-color: #222;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
    position: relative;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.notification-item.unread {
    background-color: #333;
    border-color: var(--success-color);
    border-left: 4px solid var(--success-color);
}

.notification-item:hover {
    background-color: #333;
}

.notification-item p {
    font-size: 1rem;
    margin: 0;
}

.notification-item span.timestamp {
    font-size: 0.8rem;
    color: #999;
}

.info-message {
    text-align: center;
    padding: 1rem;
    color: #aaa;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}


/* Updated Sidebar Styles */
.sidebar {
    width: 280px;
    background-color: var(--primary-color);
    color: white;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.7);
    border-right: 1px solid #333333;
    position: fixed; /* Make the sidebar fixed */
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 2rem;
}

.sidebar-logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.user-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
    width: 100%;
}

.user-avatar i {
    font-size: 4rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.sidebar-nav {
    width: 100%;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 0.5rem;
}

.sidebar-nav a {
    display: block;
    padding: 1rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.sidebar-nav a:hover {
    background-color: var(--border-color);
    color: var(--secondary-color);
}

.sidebar-nav a.active {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    font-weight: 700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.sidebar-nav a.active:hover {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

.sidebar-nav a i {
    margin-right: 10px;
    font-size: 1.2rem;
}

.sidebar-footer {
    margin-top: auto;
    width: 100%;
    padding-top: 1rem;
    display: flex;
    justify-content: center;
}

.main-content-wrapper {
    margin-left: 280px; /* Offset for the fixed sidebar */
    margin-top: 60px; /* Adjust for fixed navbar height */
    flex-grow: 1;
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    .card {
        padding: 1rem;
    }
    .btn {
        padding: 0.8rem;
        font-size: 1rem;
    }
    /* Show mobile menu button on small screens */
    .mobile-menu-btn {
        display: block;
    }
    .main-content {
        padding-top: 4rem;
    }
    .modal-content {
        margin: 1% auto;
        width: 98%;
        max-height: 98vh;
    }
    .modal-header {
        padding: 0.75rem;
    }
    .modal-title {
        font-size: 1.2rem;
        padding-right: 2.5rem;
    }
    .close-btn {
        font-size: 24px;
        right: 1rem;
    }
    .modal-body {
        padding: 0.75rem;
    }
    .modal-footer {
        padding: 0.75rem;
    }
    .modal-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    .modal-buttons .btn {
        max-width: none;
    }

    .navbar {
        justify-content: flex-end;
        width: 100%;
    }
    
    .navbar .user-info {
        display: none;
    }

    .main-content-wrapper {
        margin-left: 0;
        margin-top: 60px;
    }

    .sidebar {
        flex-direction: column;
        align-items: flex-start;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 250px;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: 0 0 25px rgba(0, 0, 0, 0.7);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .notification-dropdown {
        top: 60px;
        right: 1rem;
    }
}
/* New CSS for account disabled modal */
.disabled-account-modal .modal-content {
    text-align: center;
}

.disabled-account-modal h3 {
    margin-bottom: 1rem;
}

.disabled-account-modal p {
    font-size: 1.1rem;
    color: var(--text-color);
}
.disabled-account-modal .countdown {
    font-size: 2rem;
    font-weight: bold;
    color: var(--secondary-color);
    margin-top: 1rem;
}

/* NEW: Styles for the password toggle icon */
.input-group .password-toggle {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    color: var(--secondary-color);
    cursor: pointer;
    z-index: 10;
    transition: color 0.2s ease;
}

.input-group .password-toggle:hover {
    color: #fff;
}

/* NEW: Styles for the password requirement list */
.req-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    text-align: left;
    font-size: 0.9rem;
}

.req-list li {
    color: #999;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.req-list li.valid {
    color: var(--success-color);
}

.req-list li.valid .fa-times-circle {
    display: none;
}

.req-list li.valid::before {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    color: var(--success-color);
    margin-right: 8px;
}

.req-list li .fa-times-circle {
    color: var(--error-color);
    margin-right: 8px;
}

/* NEW: Styles for the forced password change modal */
.password-change-modal .modal-content.compact-state {
    max-width: 500px;
    height: auto;
    width: auto;
}

.password-change-modal .modal-body {
    padding-top: 0;
}

.password-change-modal .modal-message {
    color: var(--text-color);
    text-align: center;
    margin-bottom: 1rem;
}

.password-change-modal .modal-header {
    border-bottom: 2px solid var(--error-color);
}

.password-change-modal .modal-title {
    color: var(--error-color);
}

/* NEW: Styles for the spinner overlay */
.spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent black background */
    backdrop-filter: blur(5px);
    z-index: 10; /* Above the modal content, but below the modal itself */
}

.spinner-overlay .spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* New: Styles for spinner and success messages */
.button-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn.loading .btn-text, .btn.loading .btn-icon {
    opacity: 0;
}

.btn.loading .button-spinner {
    display: block;
}

.modal .modal-body.success-state {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    height: 100%;
}

.modal .animated-check {
    font-size: 3rem;
    color: var(--success-color);
    margin-bottom: 1rem;
    animation: pop-in-bounce 0.8s ease-out;
}

@keyframes pop-in-bounce {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    60% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
    }
}