/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-background);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--background);
    color: var(--text-primary);
}

.modal-content form {
    padding: 24px;
}

.settings-section {
    padding: 24px;
    text-align: center;
}

.settings-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.settings-section .small-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.settings-section .btn {
    max-width: 300px;
    margin: 0 auto;
}

/* Toggle switch styles */
.toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked+.toggle-slider {
    background-color: var(--primary-color);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(24px);
}

.toggle-switch input:focus+.toggle-slider {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.status-message {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    display: none;
}

.status-message.success {
    background: #d1fae5;
    color: #065f46;
    display: block;
}

.status-message.info {
    background: #dbeafe;
    color: #1e40af;
    display: block;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.modal-footer .btn {
    width: auto;
}

/* Username Link for View As User */
.username-link {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
}

.username-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* View As User Modal Specific Styles */
#viewAsUserModal .modal-content {
    max-width: 900px;
    width: 95%;
}

#viewAsUserModal .modal-body {
    padding: 0;
    max-height: 70vh;
    overflow-y: auto;
}

.user-preview-content {
    min-height: 200px;
}

/* Use the exact same jobs container styling as user dashboard */
#viewAsUserModal .jobs-container {
    padding: 20px;
}

/* Image Modal Styles */
.image-modal .image-modal-content {
    background: var(--card-background);
    border-radius: 16px;
    padding: 8px;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    animation: slideUp 0.3s ease-out;
}

.image-modal .close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.image-modal .close-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    transform: scale(1.1);
}

.image-modal .image-wrapper {
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 95vw;
    max-height: 90vh;
    border-radius: 12px;
    touch-action: none;
}

.image-modal img {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    display: block;
    object-fit: contain;
    transform-origin: center center;
    transition: transform 0.3s ease;
    user-select: none;
    -webkit-user-drag: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .card {
        padding: 24px;
        border-radius: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 20px 16px;
    }

    .header-buttons {
        width: 100%;
        flex-direction: row;
        justify-content: flex-end;
    }

    .header-buttons.mobile-menu-container {
        align-self: flex-end;
    }

    h1 {
        font-size: 24px;
    }

    .dashboard-header h2 {
        font-size: 22px;
    }

    /* Mobile responsive styles for user header */
    .user-header {
        padding: 24px 16px;
    }

    .header-buttons-wrapper {
        top: 20px;
        right: 16px;
    }

    .header-buttons-left {
        left: 16px;
        right: auto;
    }

    .header-buttons-left .header-buttons {
        width: auto;
    }

    .header-content-wrapper {
        flex-direction: column;
        gap: 16px;
    }

    .header-text {
        width: 100%;
    }

    .header-logo-container {
        width: 100px;
        height: 100px;
    }

    .header-greeting {
        font-size: 19px !important;
    }

    .header-subtitle {
        font-size: 14px;
    }

    table {
        font-size: 12px;
    }

    th,
    td {
        padding: 8px;
    }

    .table-container {
        margin: 0 -24px;
        padding: 0 24px;
    }

    .actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    #loginScreen .card {
        box-shadow: none;
        background: var(--card-background);
    }
}

/* PWA Install prompt */
.install-prompt {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-background);
    padding: 20px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    max-width: 90%;
    width: 400px;
    text-align: center;
    border: 2px solid var(--primary-color);
}

.install-prompt.show {
    display: block;
    animation: slideUp 0.3s ease-out;
}

.install-prompt-content p {
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.install-prompt-content p:last-of-type {
    font-size: 14px;
    color: var(--text-secondary);
}

.install-prompt-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
}

.install-prompt-buttons .btn {
    flex: 1;
    max-width: 150px;
}

@media (max-width: 480px) {
    .install-prompt {
        bottom: 10px;
        width: calc(100% - 20px);
        padding: 16px;
    }

    .install-prompt-buttons {
        flex-direction: column;
    }

    .install-prompt-buttons .btn {
        max-width: 100%;
    }
}

/* Mobile Menu */

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    color: var(--text-primary);
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.dark-mode .icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--card-background);
    box-shadow: var(--shadow-lg);
    border-radius: 12px;
    min-width: 160px;
    z-index: 100;
    overflow: hidden;
    flex-direction: column;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-menu-dropdown.show {
    display: flex;
}

.menu-item {
    background: none;
    border: none;
    padding: 12px 16px;
    text-align: left;
    width: 100%;
    font-size: 15px;
    color: var(--text-primary);
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background: var(--background);
}

