:root {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --primary-color: #bb86fc;
    --primary-variant: #3700b3;
    --secondary-color: #03dac6;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --glass-bg: rgba(30, 30, 30, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Light Mode Overrides */
body.light-mode {
    --bg-color: #f5f5f5;
    --surface-color: #ffffff;
    --primary-color: #6200ee;
    --primary-variant: #3700b3;
    --secondary-color: #03dac6;
    /* Keep or adjust for contrast */
    --text-primary: #121212;
    --text-secondary: #666666;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Header */
.app-header {
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 1px;
    color: var(--primary-color);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Main Layout */
#gallery-container {
    padding: 20px;
    padding-bottom: 80px;
    /* Space for FAB */
    max-width: 1200px;
    margin: 0 auto;
}

.search-bar-container {
    margin-bottom: 20px;
}

/* Grid */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.card {
    background: var(--surface-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    aspect-ratio: 1;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--glass-border);
}

.card:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    z-index: 2;
    border-color: var(--primary-color);
}

.card:active {
    transform: scale(0.96);
}

/* Gallery Tabs */
.gallery-tabs {
    margin-bottom: 20px;
    justify-content: center;
}

.gallery-tabs .tab-btn {
    font-size: 1rem;
    font-weight: 600;
}

/* Sub Tabs */
.sub-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sub-tab-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.sub-tab-btn:hover,
.sub-tab-btn.active {
    background: var(--primary-color);
    color: #000;
    font-weight: 600;
}

.card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Text-Only Card Style */
.card.text-card {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--surface-color) 0%, rgba(255, 255, 255, 0.05) 100%);
}

.card.text-card .text-content {
    font-size: 4rem;
    font-weight: 800;
    color: var(--primary-color);
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.card .label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
    text-transform: capitalize;
}

/* FAB */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #000;
    border: none;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 90;
    transition: transform 0.2s;
}

.fab:hover {
    transform: scale(1.05);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: rgba(30, 30, 30, 0.95);
    padding: 24px;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Inputs & Buttons */
.glass-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: white;
    font-family: inherit;
}

.glass-input:focus {
    outline: 2px solid var(--primary-color);
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-primary,
.btn-secondary,
.btn-success {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    transition: opacity 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: #000;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-success {
    background: var(--secondary-color);
    color: #000;
}

.full-width {
    width: 100%;
}

/* Tabs */
.tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    padding: 4px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
}

.tab-btn.active {
    background: var(--surface-color);
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Utilities */
.info-box {
    background: rgba(3, 218, 198, 0.1);
    color: var(--secondary-color);
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.preview-area {
    margin-top: 16px;
    border-radius: var(--radius-md);
    overflow: hidden;
    max-height: 300px;
}

.preview-area img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.hidden {
    display: none !important;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.result-item {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
}

.result-item.selected {
    border-color: var(--secondary-color);
}

.result-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.divider {
    border: 0;
    height: 1px;
    background: var(--glass-border);
    margin: 20px 0;
}

.upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.05);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Editor Mode */
.editor-controls {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.card.editor-active .editor-controls {
    opacity: 1;
    pointer-events: auto;
}

.btn-icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: transform 0.2s;
}

.btn-icon-circle:hover {
    transform: scale(1.1);
}

.bg-danger {
    background: #cf6679;
}

.bg-info {
    background: #03dac6;
    color: black;
}

/* Language Dropdown */
.lang-dropdown-container {
    position: relative;
    display: inline-block;
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px;
    min-width: 150px;
    backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.lang-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.lang-option img {
    width: 20px;
    height: auto;
    border-radius: 2px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Fixed App Footer */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.footer-content {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.footer-logo {
    height: 24px;
    width: auto;
    filter: grayscale(100%);
    opacity: 0.7;
    transition: all 0.2s;
}

.footer-logo:hover {
    filter: none;
    opacity: 1;
}

/* Add padding to body to prevent footer overlap */
body {
    padding-bottom: 50px; /* Footer height + buffer */
}
