/* Base CSS Variables */
:root {
    --primary-color: #ef4444;
    --background-color: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --text-primary: #ffffff;
    --text-secondary: #d1d5db;
    --text-tertiary: #9ca3af;
}

* {
    transition: background-color 0.3s ease, color 0.3s ease, font-family 0.3s ease;
}

body {
    background-color: var(--background-color);
    color: var(--text-primary);
}

/* Control Panel Styles */
.control-panel {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: 0 10px 60px rgba(0, 0, 0, 0.4);
    width: 320px;
    max-width: none;
    max-height: 90vh;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.control-panel.collapsed {
    min-width: auto;
}

.control-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px !important;
    border-bottom: 1px solid var(--bg-tertiary);
    cursor: pointer;
}

.control-panel-header span {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
}

.control-panel-header:hover {
    background: var(--bg-tertiary);
}

.control-panel-content {
    padding: 20px;
    max-height: calc(90vh - 60px);
    overflow-y: auto;
}

.control-panel.collapsed .control-panel-content {
    display: none;
}

.toggle-btn {
    background: var(--primary-color) !important;
    color: white !important;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: transform 0.3s;
    padding: 0 !important;
}

.control-panel.collapsed .toggle-btn {
    transform: rotate(180deg);
}

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

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
}

.control-group select,
.control-group input[type="color"] {
    width: 100% !important;
    padding: 10px 12px !important;
    border: 2px solid var(--bg-tertiary) !important;
    border-radius: 8px !important;
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    font-size: 14px !important;
    cursor: pointer;
}

.control-group input[type="color"] {
    height: 45px;
    padding: 5px !important;
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.color-preset {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-preset-btn {
    width: 42px !important;
    height: 42px !important;
    border-radius: 8px;
    border: 3px solid transparent !important;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
    padding: 0 !important;
    background: none !important;
}

.color-preset-btn:hover {
    transform: scale(1.1);
}

.color-preset-btn.active {
    border-color: var(--text-primary);
}

.color-preset-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 50%;
    background: var(--preset-primary, #ef4444);
}

.color-preset-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--preset-bg, #111827);
}

.layout-link {
    display: block;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    margin-bottom: 6px;
    font-size: 12px;
    transition: all 0.2s;
}

.layout-link:hover {
    border-color: var(--primary-color);
    transform: translateX(3px);
}

.layout-link.active {
    background: var(--primary-color);
    color: white;
}

/* Gallery and Lightbox Styles */
.gallery-image {
    height: 200px;
    width: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 8px;
}

.gallery-image:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
}

body.lightbox-active {
    overflow: hidden;
}

/* Progress Bar Animation */
.progress-fill {
    width: 0;
    transition: width 1.5s ease-out;
}

/* Common Utility Classes */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-accent { color: var(--primary-color); }
.bg-accent { background-color: var(--primary-color); }
.bg-card { background-color: var(--bg-secondary); }
.bg-card-secondary { background-color: var(--bg-tertiary); }
.border-accent { border-color: var(--primary-color); }

/* Mobile Responsive */
@media (max-width: 768px) {
    .control-panel {
        position: relative;
        top: 0;
        left: 0;
        margin: 10px;
        width: calc(100% - 20px);
    }

    .control-panel.collapsed .control-panel-content {
        display: none;
    }
}
