/* Admin Portal Styles */

:root {
    --admin-sidebar-width: 250px;
    --admin-header-height: 64px;
}

/* ===== Admin Layout ===== */

.admin-layout {
    display: flex;
    min-height: 100vh;
    background: #f5f7fa;
}

.admin-sidebar {
    width: var(--admin-sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--border-light);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.admin-main {
    margin-left: var(--admin-sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-header {
    height: var(--admin-header-height);
    background: var(--white);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.admin-content {
    flex: 1;
    padding: 2rem;
}

/* ===== Sidebar ===== */

.admin-sidebar-logo {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.admin-sidebar-logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.admin-sidebar-logo p {
    font-size: 0.8rem;
    color: var(--gray-600);
    margin: 0.25rem 0 0 0;
}

.admin-nav {
    padding: 1rem 0;
}

.admin-nav-item {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--gray-700);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.admin-nav-item:hover {
    background: var(--background-secondary);
    color: var(--primary);
}

.admin-nav-item.active {
    background: rgba(11, 110, 168, 0.1);
    color: var(--primary);
    border-left: 3px solid var(--primary);
    padding-left: calc(1.5rem - 3px);
}

/* ===== Header ===== */

.admin-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--gray-600);
}

.admin-user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-user-name {
    font-weight: 600;
    color: var(--gray-900);
}

.admin-logout-btn {
    padding: 0.5rem 1rem;
    background: var(--gray-100);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--gray-700);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-logout-btn:hover {
    background: var(--gray-200);
}

/* ===== Tables ===== */

.admin-table-container {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table thead {
    background: var(--background-secondary);
}

.admin-table th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--gray-900);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table td {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    color: var(--gray-700);
}

.admin-table tbody tr:hover {
    background: var(--background-secondary);
}

/* ===== Status Badges ===== */

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.status-new {
    background: #e3f2fd;
    color: #1976d2;
}

.status-badge.status-contacted {
    background: #fff3e0;
    color: #f57c00;
}

.status-badge.status-qualified {
    background: #e8f5e9;
    color: #388e3c;
}

.status-badge.status-assigned {
    background: #f3e5f5;
    color: #7b1fa2;
}

.status-badge.status-closed {
    background: #eeeeee;
    color: #616161;
}

.status-badge.status-active {
    background: #e8f5e9;
    color: #388e3c;
}

.status-badge.status-inactive {
    background: #eeeeee;
    color: #616161;
}

/* ===== Action Buttons ===== */

.admin-action-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--white);
    color: var(--gray-700);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.admin-action-btn:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.admin-action-btn.danger:hover {
    background: #d32f2f;
    border-color: #d32f2f;
}

/* ===== Stat Cards ===== */

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.admin-stat-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.admin-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.admin-stat-label {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.admin-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.admin-stat-change {
    font-size: 0.85rem;
    font-weight: 600;
}

.admin-stat-change.positive {
    color: #388e3c;
}

.admin-stat-change.negative {
    color: #d32f2f;
}

/* ===== Filters ===== */

.admin-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.admin-filter-input {
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 0.9rem;
}

.admin-filter-btn {
    padding: 0.625rem 1.25rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.admin-filter-btn:hover {
    background: #0056b3;
}

.admin-filter-btn.secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.admin-filter-btn.secondary:hover {
    background: var(--gray-300);
}

/* ===== Modals ===== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal {
    background: var(--white);
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--gray-900);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-600);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.modal-close:hover {
    background: var(--gray-100);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* ===== Responsive ===== */

@media (max-width: 1024px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .admin-sidebar.mobile-open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

    .admin-content {
        padding: 1.5rem 1rem;
    }

    .admin-stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .admin-header {
        padding: 0 1rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    .admin-filters {
        flex-direction: column;
    }

    .admin-filter-input,
    .admin-filter-btn {
        width: 100%;
    }
}

/* ===== Toast Notifications ===== */

.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.hide {
    transform: translateX(400px);
    opacity: 0;
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.toast-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.toast-close:hover {
    background: var(--bg-secondary);
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.success .toast-icon {
    color: var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.error .toast-icon {
    color: var(--danger);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast.warning .toast-icon {
    color: var(--warning);
}

.toast.info {
    border-left: 4px solid var(--primary);
}

.toast.info .toast-icon {
    color: var(--primary);
}

/* ===== Loading States ===== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.loading-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.table-loading {
    position: relative;
}

.table-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin-left: -20px;
    margin-top: -20px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 11;
}

/* ===== Error States ===== */

.error-message {
    background: #fee;
    border: 1px solid var(--danger);
    border-radius: 8px;
    padding: 1rem;
    color: var(--danger);
    margin-bottom: 1rem;
}

.error-message-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.empty-state-message {
    margin-bottom: 1.5rem;
}

/* ===== Mobile Toast ===== */

@media (max-width: 640px) {
    .toast-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }

    .toast {
        transform: translateY(100px);
    }

    .toast.show {
        transform: translateY(0);
    }

    .toast.hide {
        transform: translateY(100px);
    }
}
