/**
 * Admin Dashboard Styles
 * Holly Lake Dog Shelter - Volunteer Management System
 */

/* Page-level layout */
body {
    background: #f5f7fa;
    margin: 0;
    color: #333;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.portal-container {
    min-height: 100vh;
}

/* Top nav bar */
.portal-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid #e6e8ec;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 28px;
    max-width: 100%;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-brand img {
    height: 40px;
    width: auto;
    display: block;
}

.nav-brand h1 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: #2c3e50;
    letter-spacing: -0.01em;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.95rem;
}

.nav-user .user-name {
    color: #555;
}

.nav-user .logout-btn {
    background: #f5f7fa;
    color: #333;
    border: 1px solid #d8dde4;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.nav-user .logout-btn:hover {
    background: #ebeef3;
    border-color: #c1c8d2;
}

/* Main content area */
.portal-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 28px 60px;
}

.breadcrumbs {
    margin-bottom: 20px;
}

.breadcrumbs a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

/* Tabs */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 0;
    background: #fff;
    border: 1px solid #e6e8ec;
    border-radius: 12px 12px 0 0;
    border-bottom: none;
    padding: 8px 8px 0;
}

.tab-btn {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #666;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
    border-radius: 8px 8px 0 0;
    margin-bottom: -1px;
    white-space: nowrap;
}

.tab-btn:hover {
    color: #667eea;
    background: #f5f7fa;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: #fff;
}

/* Tab content sits in a card that connects visually to the tab strip.
   Display toggle (none/block) is in the existing rules below. */
.tab-content {
    background: #fff;
    border: 1px solid #e6e8ec;
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.tab-content.active {
    display: block !important;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
    background: #dc3545;
    color: white;
}

/* Tab Content (display toggle) */
.tab-content { display: none; }

.tab-content h2 {
    color: #333;
    margin-bottom: 8px;
}

.tab-description {
    color: #666;
    margin-bottom: 24px;
    font-size: 14px;
}

/* Filters */
.filters {
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filters label {
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filters select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.btn-secondary {
    padding: 8px 16px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Users Grid */
.users-grid {
    display: grid;
    gap: 20px;
}

.user-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: box-shadow 0.3s;
}

.user-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.user-card.pending-user {
    border-left: 4px solid #ffc107;
    background: #fffbf0;
}

.user-info h3 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 18px;
}

.user-email, .user-phone, .user-date {
    margin: 4px 0;
    color: #666;
    font-size: 14px;
}

.user-badges {
    margin: 8px 0;
    display: flex;
    gap: 8px;
}

.badge-admin {
    background: #dc3545;
    color: white;
}

.badge-manager {
    background: #667eea;
    color: white;
}

.badge-volunteer {
    background: #28a745;
    color: white;
}

.badge-pending {
    background: #ffc107;
    color: #333;
}

.badge-active {
    background: #28a745;
    color: white;
}

.badge-suspended {
    background: #ff6b6b;
    color: white;
}

.badge-deactivated {
    background: #6c757d;
    color: white;
}

.user-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.role-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.btn-success {
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    padding: 8px 16px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    padding: 8px 16px;
    background: #ffc107;
    color: #333;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.btn-warning:hover {
    background: #e0a800;
}

.text-muted {
    color: #999;
    font-size: 14px;
}

/* States */
.loading, .empty-state, .error-state {
    padding: 40px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.error-state {
    color: #dc3545;
}

/* Audit Log */
.audit-log {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

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

.audit-table thead {
    background: #f8f9fa;
}

.audit-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    font-size: 13px;
    border-bottom: 2px solid #e0e0e0;
}

.audit-table td {
    padding: 12px;
    font-size: 13px;
    color: #666;
    border-bottom: 1px solid #f0f0f0;
}

.audit-row:hover {
    background: #f8f9fa;
}

.audit-login {
    border-left: 3px solid #28a745;
}

.audit-user {
    border-left: 3px solid #667eea;
}

.audit-role {
    border-left: 3px solid #ffc107;
}

.audit-migration {
    border-left: 3px solid #6c757d;
}

.action-badge {
    padding: 4px 8px;
    background: #e9ecef;
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
}

/* Tab Actions */
.tab-actions {
    margin-bottom: 20px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

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

/* Dog Management */
.dogs-grid, .stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.dog-admin-card, .story-admin-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.3s;
}

.dog-admin-card:hover, .story-admin-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dog-photo, .story-photo {
    width: 100%;
    height: 200px;
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
}

.dog-photo img, .story-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 14px;
}

.status-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-available {
    background: #28a745;
    color: white;
}

.status-adopted {
    background: #6c757d;
    color: white;
}

.status-pending {
    background: #ffc107;
    color: #333;
}

.status-hold {
    background: #17a2b8;
    color: white;
}

.dog-info, .story-info {
    padding: 15px;
}

.dog-info h3, .story-info h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #333;
}

.dog-breed, .story-family {
    color: #667eea;
    font-size: 14px;
    margin: 4px 0;
}

.dog-details, .story-dog, .story-preview {
    color: #666;
    font-size: 13px;
    margin: 4px 0;
}

.dog-actions, .story-actions {
    padding: 0 15px 15px 15px;
    display: flex;
    gap: 10px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal-content {
    background: white;
    max-width: 700px;
    margin: 40px auto;
    border-radius: 12px;
    padding: 30px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

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

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: #333;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
}

.photo-preview {
    margin-top: 10px;
}

.photo-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.gallery-preview {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.gallery-preview .gallery-item {
    position: relative;
    width: 90px;
    height: 90px;
}

.gallery-preview .gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.gallery-preview .gallery-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: #e74c3c;
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
    .user-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-actions {
        margin-top: 15px;
        width: 100%;
        flex-wrap: wrap;
    }

    .role-select,
    .btn-success,
    .btn-danger,
    .btn-warning {
        width: 100%;
    }

    .audit-table {
        font-size: 12px;
    }

    .audit-table th,
    .audit-table td {
        padding: 8px;
    }

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

    .dogs-grid, .stories-grid {
        grid-template-columns: 1fr;
    }
}
