/**
 * Fair Management CSS
 * Styles for the fair management module
 */

/* CSS Variables for Night Mode */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f4f5f7;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

body.dark-mode {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-tertiary: #2a2a2a;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --border-color: #404040;
    --shadow-color: rgba(255, 255, 255, 0.05);
}

/* Edition Table Styles */
.edition-table .edition-row {
    transition: background-color 0.2s ease;
}

.edition-table .edition-row:hover {
    background-color: var(--bg-secondary);
}

/* Fair List Styles */
.fairs-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.fairs-list-header h2 {
    margin: 0;
    font-size: 24px;
}

.fairs-list-actions {
    display: flex;
    gap: 10px;
}

.fairs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.fair-card {
    background-color: var(--bg-primary);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.fair-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.fair-card-header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.fair-status-badge {
    display: inline-block !important;
    padding: 3px 8px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    font-weight: bold !important;
    color: white !important;
}

.fair-status-badge.status-published {
    background-color: #28a745 !important;
    color: white !important;
}

.fair-status-badge.status-draft {
    background-color: #ffc107 !important;
    color: #212529 !important;
}

.fair-status-badge.status-archived {
    background-color: #6c757d !important;
    color: white !important;
}

.fair-card-actions {
    display: flex;
    gap: 5px;
}

.fair-card-body {
    padding: 15px;
    flex-grow: 1;
}

.fair-name {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 18px;
}

.fair-description {
    margin: 0;
    color: #666;
    font-size: 14px;
    max-height: 60px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.fair-card-footer {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #eee;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-top: 20px;
}

.empty-state i {
    font-size: 48px;
    color: #6c757d;
    margin-bottom: 20px;
}

.empty-state h3 {
    margin-bottom: 10px;
}

.empty-state p {
    margin-bottom: 20px;
    color: #6c757d;
}

/* Fair Detail Styles */
.fair-detail-header {
    background-color: var(--bg-primary);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.fair-detail-header h2 {
    margin: 0;
    font-size: 1.8rem;
    color: #333;
}

.fair-detail-header p {
    margin: 5px 0 0 0;
    color: #666;
}

.fair-detail-header .badge {
    font-size: 0.9rem;
    padding: 5px 10px;
    margin-right: 10px;
}

.fair-detail-actions {
    display: flex;
    gap: 10px;
}

/* Fair dashboard sections */
#fair-edition-container {
    min-height: 400px;
    background-color: var(--bg-primary);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 0;
    overflow: hidden;
}

/* Quick Stats Cards */
.card {
    background-color: var(--bg-primary);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow: hidden;
    border: none;
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
    padding: 15px;
}

.card-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 15px;
}

/* Definition lists in info card */
dl.row dt {
    color: #6c757d;
    font-weight: 600;
    font-size: 14px;
}

dl.row dd {
    margin-bottom: 8px;
    font-size: 15px;
}

.fair-detail-tabs {
    margin-bottom: 20px;
}

.fair-detail-tabs ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    border-bottom: 1px solid #eee;
}

.fair-detail-tabs li {
    margin-right: 5px;
}

.fair-detail-tabs li a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #495057;
    border-radius: 4px 4px 0 0;
}

.fair-detail-tabs li a.active {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-bottom: 1px solid var(--bg-primary);
    margin-bottom: -1px;
    color: #007bff;
}

.fair-detail-content {
    background-color: var(--bg-primary);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.fair-detail-section {
    margin-bottom: 30px;
}

.fair-detail-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
}

.fair-detail-info {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.info-item {
    margin-bottom: 10px;
}

.info-label {
    font-weight: bold;
    display: block;
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 5px;
}

.info-value {
    font-size: 16px;
}

/* Edition List Styles */
.editions-list {
    margin-top: 20px;
}

.edition-card {
    background-color: var(--bg-primary);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.edition-info {
    flex-grow: 1;
}

.edition-name {
    font-size: 18px;
    margin: 0 0 5px 0;
}

.edition-dates {
    color: #6c757d;
    font-size: 14px;
}

.edition-actions {
    display: flex;
    gap: 10px;
}

/* Edition manager styles */
#fair-edition-container {
    background-color: var(--bg-primary);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

/* Edition manager card container */
.edition-manager > .card {
    max-height: calc(100vh - 150px);
    display: flex;
    flex-direction: column;
}

/* Edition form container - make it scrollable when needed */
.edition-manager-content {
    max-height: calc(100vh - 250px); /* Account for header and other UI elements */
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    flex: 1;
}

/* Ensure the form content has proper padding for scroll */
.edition-manager-content .card-body {
    padding-bottom: 30px;
}

/* Custom scrollbar for edition form */
.edition-manager-content::-webkit-scrollbar {
    width: 8px;
}

.edition-manager-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.edition-manager-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.edition-manager-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Dark mode scrollbar */
body.dark-mode .edition-manager-content::-webkit-scrollbar-track {
    background: #2a2a2a;
}

body.dark-mode .edition-manager-content::-webkit-scrollbar-thumb {
    background: #666;
}

body.dark-mode .edition-manager-content::-webkit-scrollbar-thumb:hover {
    background: #888;
}

.edition-table {
    margin-bottom: 0;
}

.edition-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    border-top: none;
}

.edition-table td {
    vertical-align: middle;
}

.edition-form {
    max-width: 800px;
    margin: 0 auto;
}

.edition-form .form-control:focus,
.edition-form .form-select:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.edition-form .form-text {
    color: #6c757d;
    font-size: 0.875em;
    margin-top: 0.25rem;
}

/* Date input container styles */
.edition-form .date-input-container {
    position: relative;
}

.edition-form .date-input-container input {
    padding-right: 35px;
}

.edition-form .date-input-container .fa-calendar-alt {
    pointer-events: none;
}

/* Make the form header sticky during scroll */
.edition-manager-content .card-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

/* Fair detail dashboard */
.fair-detail-dashboard {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 992px) {
    .fair-detail-dashboard {
        grid-template-columns: 2fr 1fr;
    }
}

.quick-stat {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: var(--bg-primary);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

.quick-stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 15px;
}

.quick-stat-icon.editions {
    background-color: #e3f2fd;
    color: #1976d2;
}

.quick-stat-icon.active {
    background-color: #e8f5e9;
    color: #388e3c;
}

.quick-stat-icon.exhibitors {
    background-color: #fff8e1;
    color: #ffa000;
}

.quick-stat-content {
    flex-grow: 1;
}

.quick-stat-value {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.quick-stat-label {
    font-size: 14px;
    color: #6c757d;
    margin: 0;
}

/* Loading and Error States */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.loading::after {
    content: "";
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    padding: 15px;
    background-color: #f8d7da;
    border-radius: 8px;
    color: #721c24;
    margin-bottom: 20px;
}

/* Back to Fairs Button */
.back-to-fairs-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    text-decoration: none;
    color: #212529;
    cursor: pointer;
}

.back-to-fairs-btn:hover {
    background-color: #e9ecef;
}

.back-to-fairs-btn i {
    font-size: 14px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .fairs-grid {
        grid-template-columns: 1fr;
    }
    
    .fair-detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .fair-detail-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .fair-detail-info {
        grid-template-columns: 1fr;
    }
    
    .edition-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .edition-info {
        margin-bottom: 10px;
    }
    
    /* Adjust edition form container height for mobile */
    .edition-manager-content {
        max-height: calc(100vh - 180px);
    }
    
    /* Ensure form fields stack properly on mobile */
    .edition-form .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    .edition-form .col-md-6 {
        padding-left: 0;
        padding-right: 0;
    }
}