/* ========================================
   Image Editor - Dark Theme
   Matching sports-schedule color palette
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #09090b;
    color: #fafafa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ========================================
   Navbar
   ======================================== */

.navbar {
    background-color: rgba(15, 15, 18, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0 1rem;
    height: 48px;
    display: flex;
    align-items: center;
    z-index: 100;
    flex-shrink: 0;
}

.navbar-inner {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-icon {
    font-size: 1.25rem;
}

.brand-text {
    font-weight: 700;
    font-size: 1rem;
    color: #fafafa;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-user {
    color: #a1a1aa;
    font-size: 0.85rem;
    font-weight: 500;
}

.logout-link {
    color: #a1a1aa;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.nav-icon {
    font-size: 0.9rem;
}

/* ========================================
   Top Toolbar
   ======================================== */

.toolbar {
    background: linear-gradient(180deg, #141416 0%, #111113 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    height: 48px;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0 0.35rem;
}

.tool-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.65rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #a1a1aa;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.tool-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.06);
    color: #fafafa;
    border-color: rgba(255, 255, 255, 0.08);
}

.tool-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.tool-btn .tool-icon {
    font-size: 1rem;
}

.tool-btn .tool-label {
    font-weight: 500;
}

/* ========================================
   Editor Layout
   ======================================== */

.editor-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.editor-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ========================================
   Sidebars
   ======================================== */

.sidebar {
    width: 220px;
    background: linear-gradient(180deg, #111113 0%, #0f0f11 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-right {
    border-right: none;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-section {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #71717a;
    margin-bottom: 0.6rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ========================================
   Tool Grid (Left Sidebar)
   ======================================== */

.tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
}

.sidebar-tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.5rem 0.25rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    color: #a1a1aa;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.sidebar-tool span {
    font-size: 1.1rem;
}

.sidebar-tool small {
    font-size: 0.65rem;
    font-weight: 500;
}

.sidebar-tool:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fafafa;
    border-color: rgba(255, 255, 255, 0.1);
}

.sidebar-tool.active {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(37, 99, 235, 0.08) 100%);
    border-color: rgba(37, 99, 235, 0.3);
    color: #60a5fa;
}

/* ========================================
   Background Controls
   ======================================== */

.bg-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.color-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-row label {
    font-size: 0.75rem;
    color: #a1a1aa;
    min-width: 40px;
}

.color-row input[type="color"] {
    width: 32px;
    height: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    background: none;
    cursor: pointer;
    padding: 0;
}

.color-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-row input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

/* ========================================
   Small Buttons
   ======================================== */

.small-btn {
    padding: 0.35rem 0.6rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: #a1a1aa;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.small-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fafafa;
}

.small-btn.primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-color: transparent;
    color: #fff;
}

.small-btn.primary:hover {
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.icon-btn {
    background: none;
    border: none;
    color: #71717a;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.15rem;
    transition: color 0.15s ease;
}

.icon-btn:hover {
    color: #ef4444;
}

/* ========================================
   Canvas Area
   ======================================== */

.canvas-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0a0a0c;
    background-image:
        linear-gradient(45deg, #0f0f11 25%, transparent 25%),
        linear-gradient(-45deg, #0f0f11 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #0f0f11 75%),
        linear-gradient(-45deg, transparent 75%, #0f0f11 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    overflow: hidden;
    position: relative;
}

.canvas-container {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.canvas-info {
    position: absolute;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
    padding: 0.35rem 0.75rem;
    background: rgba(15, 15, 18, 0.9);
    backdrop-filter: blur(8px);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.7rem;
    color: #71717a;
}

/* ========================================
   Layers Panel
   ======================================== */

.layers-list {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    max-height: 300px;
    overflow-y: auto;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.75rem;
    color: #a1a1aa;
}

.layer-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.layer-item.active {
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(37, 99, 235, 0.25);
    color: #fafafa;
}

.layer-thumb {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
    overflow: hidden;
}

.layer-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.layer-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.layer-visibility {
    background: none;
    border: none;
    color: #71717a;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.1rem;
    transition: color 0.15s ease;
    flex-shrink: 0;
}

.layer-visibility:hover {
    color: #fafafa;
}

.layer-visibility.hidden {
    opacity: 0.3;
}

.empty-layers {
    color: #52525b;
    font-size: 0.75rem;
    text-align: center;
    padding: 1.5rem 0.5rem;
}

/* ========================================
   Properties Panel
   ======================================== */

.properties-content {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.prop-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.prop-row label {
    font-size: 0.7rem;
    color: #71717a;
    min-width: 45px;
    flex-shrink: 0;
}

.prop-input {
    flex: 1;
    padding: 0.3rem 0.5rem;
    background: #09090b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    color: #e4e4e7;
    font-family: inherit;
    font-size: 0.75rem;
    min-width: 0;
    transition: border-color 0.15s ease;
}

.prop-input:focus {
    outline: none;
    border-color: #2563eb;
}

.prop-select {
    flex: 1;
    padding: 0.3rem 0.4rem;
    background: #09090b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    color: #e4e4e7;
    font-family: inherit;
    font-size: 0.75rem;
    min-width: 0;
    cursor: pointer;
}

.prop-select:focus {
    outline: none;
    border-color: #2563eb;
}

.range-input {
    flex: 1;
    min-width: 0;
    accent-color: #2563eb;
    height: 4px;
}

.range-val {
    font-size: 0.65rem;
    color: #71717a;
    min-width: 28px;
    text-align: right;
}

/* Text style buttons */
.text-style-row {
    display: flex;
    gap: 0.25rem;
}

.style-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    color: #a1a1aa;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    transition: all 0.15s ease;
}

.style-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fafafa;
}

.style-btn.active {
    background: rgba(37, 99, 235, 0.15);
    border-color: rgba(37, 99, 235, 0.3);
    color: #60a5fa;
}

/* Filter presets */
.filter-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* ========================================
   Modal
   ======================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal {
    background: linear-gradient(145deg, #18181b 0%, #141416 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.5rem;
    min-width: 320px;
}

.modal-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.modal-body .prop-row label {
    min-width: 80px;
}

.modal-body .prop-input {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ========================================
   Crop Bar
   ======================================== */

.crop-bar {
    position: fixed;
    top: 96px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 15, 18, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 150;
    font-size: 0.8rem;
    color: #a1a1aa;
}

/* ========================================
   Drop Overlay
   ======================================== */

.drop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(37, 99, 235, 0.1);
    border: 3px dashed #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.drop-message {
    font-size: 1.5rem;
    font-weight: 700;
    color: #60a5fa;
    background: rgba(15, 15, 18, 0.9);
    padding: 1.5rem 3rem;
    border-radius: 12px;
}

/* ========================================
   Scrollbar Styling
   ======================================== */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ========================================
   Container (for non-editor pages)
   ======================================== */

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 900px) {
    .sidebar-left {
        width: 56px;
    }

    .sidebar-left .sidebar-title,
    .sidebar-left .bg-controls,
    .sidebar-left #drawOptions {
        display: none !important;
    }

    .sidebar-left .tool-grid {
        grid-template-columns: 1fr;
    }

    .sidebar-left .sidebar-tool small {
        display: none;
    }

    .sidebar-right {
        width: 180px;
    }

    .tool-btn .tool-label {
        display: none;
    }
}

@media (max-width: 640px) {
    .sidebar-right {
        display: none;
    }
}
