/* ========================================
   Dashboard Specific Styles
   ======================================== */

/* Override body overflow hidden from main styles */
body {
    overflow: auto !important;
}

.dashboard-container {
    margin-top: 70px; /* Below header */
    padding: 30px;
    min-height: calc(100vh - 70px);
    background: #f5f5f5;
    overflow-y: auto;
}

/* ========================================
   Summary Cards
   ======================================== */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 18px;
    min-height: 100px;
    max-height: 140px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.card-icon {
    font-size: 36px;
    line-height: 1;
}

.card-content h3 {
    font-size: 14px;
    font-weight: 500;
    color: #666;
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    margin: 0;
    line-height: 1.2;
}

.card-subvalue {
    font-size: 13px;
    color: #888;
    margin: 4px 0 0 0;
}

.card-subvalue span {
    font-weight: 600;
    color: #ff6b6b;
}

/* Visibility Chips */
.visibility-chips {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.chip-visible {
    background: #e8f5e9;
    color: #2e7d32;
}

.chip-hidden {
    background: #ffebee;
    color: #c62828;
}

.chip-label {
    opacity: 0.8;
}

.chip-value {
    font-weight: 700;
    font-size: 16px;
}

.region-list {
    font-size: 14px;
    color: #333;
    line-height: 1.8;
    max-height: 90px;
    overflow-y: auto;
    overflow-x: hidden;
    column-count: 2;
    column-gap: 16px;
}

.region-list div {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    break-inside: avoid;
}

.region-list span:last-child {
    font-weight: 600;
    color: #ff6b6b;
}

/* ========================================
   Control Bar
   ======================================== */
.control-bar {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.control-group {
    display: flex;
    gap: 12px;
    flex: 3;
    min-width: 300px;
}

.search-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #ff6b6b;
}

.filter-select {
    padding: 10px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: #ff6b6b;
}

.csv-controls {
    display: flex;
    gap: 8px;
}

/* ========================================
   Buttons
   ======================================== */
.btn-primary {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary:hover {
    background: #ff5252;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 107, 107, 0.3);
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

.btn-danger {
    background: #d32f2f;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: #c62828;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(211, 47, 47, 0.3);
}

/* ========================================
   Data Table
   ======================================== */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 20px;
}

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

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

.data-table th {
    padding: 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.data-table th.sortable:hover {
    background: #f0f0f0;
}

.sort-arrow {
    margin-left: 4px;
    font-size: 10px;
    color: #999;
}

.data-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: #fafafa;
}

/* Hidden restaurant row styling */
.data-table tbody tr.hidden-restaurant {
    background: #f9f9f9;
    opacity: 0.7;
}

.data-table tbody tr.hidden-restaurant:hover {
    background: #f0f0f0;
    opacity: 0.85;
}

.data-table td {
    padding: 16px;
    font-size: 14px;
    color: #333;
}

.visibility-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    transition: transform 0.2s ease;
}

.visibility-toggle:hover {
    transform: scale(1.2);
}

.action-btn {
    background: none;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 16px;
    transition: transform 0.2s ease;
}

.action-btn:hover {
    transform: scale(1.2);
}

.action-btn.edit {
    color: #2196F3;
}

.action-btn.delete {
    color: #d32f2f;
}

/* ========================================
   Pagination
   ======================================== */
.pagination {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.pagination-info {
    font-size: 14px;
    color: #666;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rows-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    cursor: pointer;
}

.btn-pagination {
    background: #f5f5f5;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-pagination:hover:not(:disabled) {
    background: #e0e0e0;
    border-color: #ccc;
}

.btn-pagination:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-size: 13px;
    color: #666;
    padding: 0 8px;
}

/* ========================================
   Modal Overrides
   ======================================== */
.modal-small .modal-content {
    max-width: 450px;
}

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

.form-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.form-hint.warning-hint {
    color: #f57c00;
    background: #fff3e0;
    padding: 8px;
    border-radius: 4px;
    border-left: 3px solid #f57c00;
}

.form-hint a {
    color: #2196F3;
    text-decoration: none;
}

.form-hint a:hover {
    text-decoration: underline;
}

.text-danger {
    color: #d32f2f;
    font-size: 14px;
}

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

    .summary-cards {
        grid-template-columns: 1fr;
    }

    .control-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .control-group {
        flex-direction: column;
        min-width: 100%;
    }

    .csv-controls {
        width: 100%;
    }

    .csv-controls button,
    .csv-controls label {
        flex: 1;
    }

    .table-container {
        overflow-x: auto;
    }

    .data-table {
        min-width: 800px;
    }

    .pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

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

/* ========================================
   Photo Grid and Image Selection
   ======================================== */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
    background: #f9f9f9;
    border-radius: 8px;
}

.photo-item {
    position: relative;
    aspect-ratio: 4/3;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.photo-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.photo-item.selected {
    border-color: #4CAF50;
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.4);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-item-btn {
    background: #fff;
    color: #333;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.photo-item-btn:hover {
    background: #4CAF50;
    color: white;
}

.photo-item.selected .photo-item-btn {
    background: #4CAF50;
    color: white;
}

.photo-checkmark {
    display: none;
    position: absolute;
    top: 6px;
    right: 6px;
    background: #4CAF50;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.photo-item.selected .photo-checkmark {
    display: flex;
}

/* Make modal body scrollable */
.modal-content {
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-body {
    overflow-y: auto;
    flex: 1;
}

/* Read-only input styling */
input[readonly] {
    background-color: #f5f5f5;
    cursor: not-allowed;
    border-color: #e0e0e0;
}

#fetch-details-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}


/* ========================================
   Custom Photo Upload Section
   ======================================== */
.photo-upload-area {
    margin: 12px 0;
}

.custom-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.custom-photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e0e0e0;
    background: #f5f5f5;
}

.custom-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.custom-photo-item .photo-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(220, 38, 38, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.custom-photo-item .photo-delete-btn:hover {
    background: rgba(220, 38, 38, 1);
    transform: scale(1.1);
}

.custom-photo-item .photo-order {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}

.custom-photo-item.uploading {
    opacity: 0.6;
}

.custom-photo-item.uploading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Compact button for squeezed layout */
.btn-compact {
    padding: 10px 16px;
    font-size: 14px;
    white-space: nowrap;
}

/* Chip styles for table cells */
.table-chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

/* Category chips */
.chip-deli {
    background: #000000;
    color: white;
}

.chip-red-sauce {
    background: #aa1d1d;
    color: white;
}

.chip-pizzeria {
    background: #fc0606;
    color: white;
}

/* Rank/Status chips */
.chip-classic {
    background: #fbbf24;
    color: #78350f;
}

.chip-new {
    background: #34d399;
    color: #065f46;
}

.chip-user-recommended {
    background: #60a5fa;
    color: #1e3a8a;
}

.chip-closed {
    background: #9ca3af;
    color: #1f2937;
}

/* Region chips */
.chip-region {
    background: #e5e7eb;
    color: #374151;
}
