/* ================================================
   Heyo Production Frontend - Styles
   ================================================ */

/* CSS Variables */
:root {
    /* Dark Theme (Default) */
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #252525;
    --bg-card: #1e1e1e;
    --bg-hover: #2a2a2a;

    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-tertiary: #707070;

    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    --border-color: #333333;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

    --sidebar-width: 260px;
    --topbar-height: 70px;

    --transition: all 0.3s ease;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e5e5e5;
    --bg-card: #ffffff;
    --bg-hover: #f0f0f0;

    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-tertiary: #999999;

    --border-color: #e0e0e0;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ================================================
   Sidebar Navigation
   ================================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo i {
    color: var(--accent-primary);
    font-size: 1.8rem;
}

.version {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: 4px;
}

.nav-menu {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin-bottom: 4px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-md);
}

.nav-item i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

.health-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 2s infinite;
}

.status-dot.healthy {
    background: var(--success);
    animation: none;
}

.status-dot.error {
    background: var(--error);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ================================================
   Main Content Area
   ================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-primary);
}

/* Topbar */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 50;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 12px 20px;
    width: 400px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.search-bar:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.search-bar i {
    color: var(--text-tertiary);
}

.search-bar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.search-bar input::placeholder {
    color: var(--text-tertiary);
}

.topbar-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-large {
    padding: 16px 32px;
    font-size: 1rem;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-sm:hover {
    background: var(--accent-primary);
    color: white;
}

.btn-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--accent-primary);
    color: white;
}

.btn-icon.active {
    background: var(--accent-primary);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ================================================
   Pages
   ================================================ */
.page {
    display: none;
    padding: 32px;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ================================================
   Dashboard
   ================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.stat-icon.green {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.stat-icon.purple {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.stat-icon.orange {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

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

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h3 i {
    color: var(--accent-primary);
}

.card-body {
    padding: 24px;
}

/* Health Checks */
.health-checks {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.health-check-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
}

.health-check-item .check-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.health-check-item .check-status {
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 20px;
}

.health-check-item .check-status.pass {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.health-check-item .check-status.fail {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

/* Model List */
.model-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.model-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
}

.model-item .model-name {
    font-weight: 500;
}

.model-item .model-status {
    font-size: 0.85rem;
    color: var(--success);
}

.model-item .model-status.disabled {
    color: var(--text-tertiary);
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.activity-item i {
    color: var(--accent-primary);
}

.activity-item span {
    flex: 1;
}

.activity-item small {
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

/* ================================================
   Upload Page
   ================================================ */
.upload-container {
    max-width: 800px;
    margin: 0 auto;
}

.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 60px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-card);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-content i {
    font-size: 4rem;
    color: var(--accent-primary);
    margin-bottom: 20px;
}

.upload-content h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.upload-content p {
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.upload-hint {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.upload-options {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.upload-options h4 {
    margin-bottom: 16px;
    font-size: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
}

.upload-queue {
    margin-top: 24px;
}

.upload-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    margin-bottom: 12px;
}

.upload-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.upload-item-info {
    flex: 1;
}

.upload-item-info .name {
    font-weight: 500;
    margin-bottom: 4px;
}

.upload-item-info .size {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.upload-item .progress-bar {
    width: 100px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.upload-item .progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    width: 0%;
    transition: width 0.3s ease;
}

.upload-item .status-icon {
    font-size: 1.2rem;
}

.upload-item .status-icon.success {
    color: var(--success);
}

.upload-item .status-icon.error {
    color: var(--error);
}

.upload-actions {
    margin-top: 24px;
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* ================================================
   Search Page
   ================================================ */
.search-container {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 32px;
}

.search-input-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
}

.search-mode-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.tab {
    flex: 1;
    padding: 12px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    background: var(--accent-gradient);
    color: white;
}

.image-drop-zone,
.face-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.image-drop-zone:hover,
.face-drop-zone:hover {
    border-color: var(--accent-primary);
}

.image-drop-zone i,
.face-drop-zone i {
    font-size: 3rem;
    color: var(--accent-primary);
    margin-bottom: 12px;
}

.search-preview,
.face-preview {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.search-preview img,
.face-preview img {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    background: var(--bg-tertiary);
}

.btn-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-remove:hover {
    background: var(--error);
}

.text-search-box {
    margin-bottom: 20px;
}

.text-search-box textarea {
    width: 100%;
    min-height: 150px;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    outline: none;
    transition: var(--transition);
}

.text-search-box textarea:focus {
    border-color: var(--accent-primary);
}

.text-search-box textarea::placeholder {
    color: var(--text-tertiary);
}

.search-params,
.face-params {
    display: flex;
    gap: 16px;
    margin: 20px 0;
}

.param-group {
    flex: 1;
}

.param-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.param-group input[type="number"] {
    width: 100%;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
}

.param-group input[type="range"] {
    width: 100%;
    accent-color: var(--accent-primary);
}

.param-group span {
    display: block;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.search-input-section .btn-large,
.face-input-section .btn-large {
    width: 100%;
    margin-top: 16px;
}

/* Search Results */
.search-results-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.results-header h3 {
    font-size: 1.1rem;
}

.results-header span {
    color: var(--text-secondary);
    font-weight: normal;
}

.results-actions select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    outline: none;
}

.results-grid,
.face-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.result-card {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.result-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.result-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.result-card .result-info {
    padding: 12px;
}

.result-card .score {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.result-card .score-value {
    font-weight: 600;
    color: var(--success);
}

.result-card .score-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    margin-left: 12px;
    overflow: hidden;
}

.result-card .score-fill {
    height: 100%;
    background: var(--success);
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.no-results i {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ================================================
   Face Search Page
   ================================================ */
.face-search-container {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 32px;
}

.face-input-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
}

.face-info-card {
    margin-top: 24px;
    padding: 20px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--border-radius-sm);
}

.face-info-card h4 {
    margin-bottom: 12px;
    color: var(--accent-primary);
}

.face-info-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.face-info-card ul {
    list-style: none;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.face-info-card li {
    padding: 4px 0;
    padding-left: 20px;
    position: relative;
}

.face-info-card li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent-primary);
}

.face-results-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
}

/* ================================================
   Gallery Page
   ================================================ */
.gallery-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.gallery-filters select {
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    outline: none;
}

.gallery-view-toggle {
    display: flex;
    gap: 8px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.gallery-item {
    position: relative;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.gallery-item:hover {
    transform: scale(1.02);
}

.gallery-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.gallery-item .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    opacity: 0;
    transition: var(--transition);
}

.gallery-item:hover .overlay {
    opacity: 1;
}

.gallery-item .overlay span {
    font-size: 0.85rem;
    color: white;
}

.gallery-pagination {
    text-align: center;
}

/* ================================================
   Settings Page
   ================================================ */
.settings-container {
    max-width: 800px;
}

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 24px;
}

.settings-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.settings-section h3 i {
    color: var(--accent-primary);
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    color: var(--text-secondary);
}

.setting-item input[type="text"],
.setting-item input[type="password"],
.setting-item input[type="number"],
.setting-item select {
    width: 300px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    outline: none;
}

.setting-item input[type="range"] {
    width: 200px;
    accent-color: var(--accent-primary);
}

.settings-actions {
    display: flex;
    gap: 16px;
    margin-top: 32px;
}

/* ================================================
   Modal
   ================================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 32px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    overflow: hidden;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition);
}

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

.modal-body {
    flex: 1;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.modal-info {
    width: 300px;
    padding: 24px;
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
}

.modal-info h3 {
    margin-bottom: 20px;
}

.modal-details {
    margin-bottom: 24px;
}

.modal-details .detail-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.modal-details .detail-label {
    color: var(--text-secondary);
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-actions .btn {
    width: 100%;
}

/* ================================================
   Toast Notifications
   ================================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    padding: 16px 24px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

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

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

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

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

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

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

/* ================================================
   Loading Overlay
   ================================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1200;
}

.loading-overlay.active {
    display: flex;
}

.loader {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.loader p {
    color: var(--text-secondary);
}

/* ================================================
   Responsive Design
   ================================================ */
@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid .recent-activity {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1200px) {
    .search-container,
    .face-search-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
    }

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

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

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

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

    .topbar {
        padding: 0 16px;
    }

    .search-bar {
        width: 100%;
    }

    .modal-content {
        flex-direction: column;
    }

    .modal-info {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
}

/* ================================================
   Unified Search Results - Match Status Banners
   ================================================ */

.match-status-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
    grid-column: 1 / -1; /* Span full width when inside grid */
}

.match-status-banner.match-found {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.05) 100%);
    border: 2px solid var(--success);
}

.match-status-banner.no-match {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.05) 100%);
    border: 2px solid var(--warning);
}

.match-status-banner.no-results {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.match-status-banner .match-icon {
    font-size: 48px;
}

.match-status-banner.match-found .match-icon {
    color: var(--success);
}

.match-status-banner.no-match .match-icon {
    color: var(--warning);
}

.match-status-banner.no-results .match-icon {
    color: var(--text-tertiary);
}

.match-status-banner .match-info h3 {
    margin: 0 0 4px 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.match-status-banner.match-found .match-info h3 {
    color: var(--success);
}

.match-status-banner .match-info p {
    margin: 0 0 4px 0;
    color: var(--text-secondary);
}

.match-status-banner .match-info small {
    color: var(--text-tertiary);
    display: block;
}

.match-status-banner .match-info small i {
    margin-right: 4px;
}

/* Results Grid for unified search */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

/* Match type badges */
.match-badges {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.match-badges .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.match-badges .badge.visual {
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
}

.match-badges .badge.face {
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent-secondary);
    border: 1px solid var(--accent-secondary);
}

.match-badges .badge i {
    font-size: 10px;
}

/* Enhanced result card for unified search */
.result-card .result-info {
    padding: 12px;
    background: linear-gradient(to top, var(--bg-card) 0%, transparent 100%);
}

@media (max-width: 768px) {
    .match-status-banner {
        flex-direction: column;
        text-align: center;
        padding: 16px;
    }

    .match-status-banner .match-icon {
        font-size: 36px;
    }

    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
