/* ============================================================
   ADMIN DASHBOARD STYLES
   Functional, dark-themed admin interface
   ============================================================ */

/* Layout */
.admin-page {
    background: #f5f5f5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
}

.login-box {
    background: white;
    border-radius: 8px;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    margin: 0 0 0.5rem;
    color: #333;
    font-size: 1.8rem;
}

.login-box .subtitle {
    margin: 0 0 2rem;
    color: #666;
    font-size: 0.95rem;
}

/* Dashboard Container */
.dashboard-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #f5f5f5;
}

/* Header */
.admin-header {
    background: white;
    border-bottom: 1px solid #ddd;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dashboard-title {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.header-right {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Admin Role Badge */
.admin-role-badge {
    display: flex;
    align-items: center;
}

.role-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.role-super-admin {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #78350f;
    border: 1px solid #f59e0b;
}

.role-admin {
    background: #e0e7ff;
    color: #4338ca;
    border: 1px solid #a5b4fc;
}

/* Navigation */
.admin-nav {
    background: white;
    border-bottom: 1px solid #ddd;
    padding: 0 2rem;
    display: flex;
    gap: 0;
    overflow-x: auto;
}

.nav-tab {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    color: #666;
    font-size: 0.95rem;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav-tab:hover {
    color: #333;
    background: #f9f9f9;
}

.nav-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* Main Content */
.admin-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-title-row h2 {
    margin: 0;
}

.admin-section h2 {
    margin-top: 0;
    color: #333;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-section h3 {
    color: #333;
    font-size: 1.1rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #667eea;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 0.5rem;
}

.metric-label {
    color: #666;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Status Grid */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.status-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.status-label {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.status-value {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

/* Tables */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.admin-table thead {
    background: #f9f9f9;
    border-bottom: 2px solid #e0e0e0;
}

.admin-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-table td {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    color: #555;
}

.admin-table tbody tr:hover {
    background: #f9f9f9;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

/* Data Table Container */
.data-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.empty-state {
    padding: 2rem;
    text-align: center;
    color: #999;
}

.loading {
    padding: 2rem;
    text-align: center;
    color: #999;
}

/* Activity List */
.activity-list {
    padding: 1rem;
}

.activity-item {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    gap: 1rem;
}

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

.activity-item .time {
    color: #999;
    font-size: 0.85rem;
    min-width: 80px;
    font-family: monospace;
}

.activity-item .activity {
    color: #555;
    flex: 1;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-secondary {
    background: #e2e3e5;
    color: #383d41;
}

/* Forms */
.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
    font-size: 0.95rem;
}

.description-field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.description-field-header .form-label {
    margin-bottom: 0;
}

.form-input {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ai-item-note {
    margin-top: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid #cfe8dc;
    border-left: 4px solid #2f7d67;
    border-radius: 6px;
    background: #f3fbf7;
    color: #255246;
    font-size: 0.9rem;
    line-height: 1.45;
}

.ai-item-note strong {
    color: #174338;
}

.description-improve-result {
    margin-top: 0.75rem;
    padding: 0.75rem 0.9rem;
    border-radius: 6px;
    background: #fff8e6;
    border: 1px solid #f1d28a;
    color: #684a08;
    font-size: 0.86rem;
    line-height: 1.4;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.admin-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: flex-start;
    min-width: 0;
}

.admin-contact-link {
    color: #3557d4;
    font-weight: 650;
    text-decoration: underline;
    text-underline-offset: 0.16em;
}

.admin-contact-link:hover {
    color: #243c9f;
}

.text-muted {
    color: #777;
}

/* Filter Group */
.filter-group {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.filter-group label {
    color: #666;
    font-weight: 500;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
}

.pagination-links {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    color: #667eea;
    font-weight: 500;
    transition: all 0.2s;
}

.pagination-btn:hover {
    background: #f9f9f9;
    border-color: #667eea;
}

.pagination-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Modals */
.modal {
    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: 1000;
    padding: 2rem;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content.modal-large {
    max-width: 800px;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.user-details h3 {
    margin: 1rem 0 0.5rem;
    color: #333;
}

.user-details p {
    margin: 0.25rem 0;
    color: #666;
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: #333;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

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

.toast-success {
    background: #28a745;
}

.toast-error {
    background: #dc3545;
}

.toast-warning {
    background: #ffc107;
    color: #333;
}

.toast-info {
    background: #17a2b8;
}

/* Buttons */
.btn-block {
    width: 100%;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-danger {
    background: #b42318;
    color: white;
    border: 1px solid #b42318;
}

.btn-danger:hover {
    background: #912018;
    border-color: #912018;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

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

    .admin-content {
        padding: 1rem;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .admin-table {
        font-size: 0.85rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.75rem;
    }

    .filter-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-title-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-row-actions {
        min-width: 8rem;
    }

    .modal-content {
        max-width: 100%;
    }

    .toast {
        min-width: 280px;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 1.5rem;
    }

    .dashboard-title {
        font-size: 1.2rem;
    }

    .metric-value {
        font-size: 1.8rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.5rem;
    }

    .admin-table th {
        font-size: 0.8rem;
    }

    .admin-table td {
        font-size: 0.85rem;
    }

    .btn-small {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
}

/* Image Upload */
.image-upload-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-upload-zone:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.image-upload-zone.drag-over {
    border-color: #667eea;
    background: #e8edff;
    transform: scale(1.02);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: #999;
    margin-bottom: 0.5rem;
}

.upload-text {
    margin: 0;
    font-size: 0.95rem;
    color: #333;
}

.upload-btn {
    background: none;
    border: none;
    color: #667eea;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
    padding: 0;
    font-size: 0.95rem;
}

.upload-btn:hover {
    color: #764ba2;
}

.upload-hint {
    margin: 0;
    font-size: 0.8rem;
    color: #999;
}

.image-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.image-preview img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.remove-image-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s ease;
}

.remove-image-btn:hover {
    background: #ff5252;
}

/* ============================================================
   BRAND FINISH — Admin Console
   ============================================================ */

.admin-page {
    background:
        linear-gradient(180deg, rgba(255, 250, 240, 0.95), rgba(244, 247, 242, 1));
    color: #172235;
    font-family: "Avenir Next", "Trebuchet MS", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-container {
    background:
        linear-gradient(90deg, rgba(9, 17, 33, 0.82), rgba(9, 17, 33, 0.36)),
        url("../images/brand/silent-bid-buddy-social-1200x630.png") center / cover no-repeat;
}

.login-box,
.metric-card,
.status-card,
.data-table,
.admin-table,
.form-section,
.modal-content {
    background: rgba(255, 253, 248, 0.96);
    border: 1px solid rgba(23, 34, 53, 0.1);
    border-radius: 8px;
    box-shadow: 0 16px 34px rgba(23, 34, 53, 0.1);
}

.login-box {
    border-top: 4px solid #d99a2b;
}

.login-box h1,
.dashboard-title,
.admin-section h2,
.admin-section h3 {
    color: #172235;
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0;
}

.login-box .subtitle,
.metric-label,
.status-label,
.admin-table td,
.empty-state,
.loading {
    color: rgba(23, 34, 53, 0.66);
}

.dashboard-container {
    background: transparent;
}

.admin-header,
.admin-nav {
    background: rgba(255, 253, 248, 0.92);
    border-color: rgba(23, 34, 53, 0.1);
    box-shadow: 0 12px 30px rgba(23, 34, 53, 0.06);
    backdrop-filter: blur(18px);
}

.nav-tab {
    color: rgba(23, 34, 53, 0.66);
    font-weight: 800;
}

.nav-tab:hover {
    color: #172235;
    background: #fff4d8;
}

.nav-tab.active {
    color: #28785f;
    border-bottom-color: #d99a2b;
}

.metric-card {
    border-left-color: #d99a2b;
}

.metric-value,
.status-value {
    color: #315fcb;
    font-family: Georgia, "Times New Roman", serif;
}

.admin-table thead {
    background: #fff4d8;
    border-bottom-color: rgba(217, 154, 43, 0.35);
}

.admin-table th {
    color: #172235;
}

.admin-table tbody tr:hover {
    background: #f4f7f2;
}

.form-input,
.form-select,
.form-textarea,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea,
select {
    background: #fffaf0;
    border-color: rgba(23, 34, 53, 0.16);
    color: #172235;
    border-radius: 8px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
input:focus,
textarea:focus,
select:focus {
    border-color: #d99a2b;
    box-shadow: 0 0 0 4px rgba(217, 154, 43, 0.16);
    outline: none;
}

.image-upload-zone {
    background: #fffaf0;
    border-color: rgba(217, 154, 43, 0.42);
}

.image-upload-zone:hover,
.image-upload-zone.drag-over {
    background: #fff4d8;
    border-color: #d99a2b;
}

.upload-btn {
    color: #315fcb;
    font-weight: 800;
}

.upload-btn:hover {
    color: #28785f;
}
