﻿/* Toggles: Stacked (1 column) on Desktop */
.toggle-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
/* Toggles: Side-by-side (2 columns) on Mobile */
@media (max-width: 768px), (orientation: portrait) {
    .toggle-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* --- TWO COLUMN GRID FOR COMPACT UI --- */
.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px; /* 🌟 Reduced vertical gap from 12px to 8px */
}

.slider-control {
    display: flex;
    flex-direction: column;
}

.toggle-label {
    font-size: 0.75rem;
    gap: 4px;
}

/* Compact color picker row */
.color-picker-wrapper {
    font-size: 0.75rem;
}

.tool-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

    .tool-section.bottom {
        margin-top: 0;
        padding-top: 15px;
        border-top: 2px solid #e5e7eb;
    }

.section-title {
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    color: #9ca3af;
    letter-spacing: 0.05em;
}

.slider-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #4b5563;
    display: flex;
    justify-content: space-between;
    margin-top: 2px; /* 🌟 Reduced from 5px */
    white-space: nowrap;
}

.zoom-slider {
    width: 100%;
    margin-top: 2px; /* 🌟 Reduced from 5px */
    margin-bottom: 2px;
    cursor: pointer;
    accent-color: #3b82f6;
}

.btn-tool {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background-color: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    color: #374151;
    transition: all 0.2s;
    text-align: left;
}

    .btn-tool:hover:not(:disabled) {
        background-color: #eff6ff;
        border-color: #3b82f6;
        color: #1d4ed8;
    }

    .btn-tool:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.btn-danger {
    color: #dc2626;
    background-color: #fef2f2;
    border-color: #fecaca;
}

    .btn-danger:hover:not(:disabled) {
        background-color: #fee2e2;
        border-color: #ef4444;
    }

.btn-success {
    color: #166534;
    background-color: #f0fdf4;
    border-color: #bbf7d0;
}

    .btn-success:hover:not(:disabled) {
        background-color: #dcfce7;
        border-color: #22c55e;
    }

.label-with-reset {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-reset {
    background: none;
    border: none;
    padding: 0;
    color: #9ca3af;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    line-height: 1;
    transition: color 0.2s, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
}

    .btn-reset:hover:not(:disabled) {
        color: #3b82f6;
        transform: rotate(-45deg);
    }

    .btn-reset:disabled {
        opacity: 0;
        pointer-events: none;
    }

/* --- TOGGLE SWITCH UI --- */
.setting-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px; /* 🌟 Reduced vertical padding from 10px to 6px */
    background-color: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    transition: opacity 0.2s;
}

    .setting-toggle.disabled {
        opacity: 0.5;
        pointer-events: none;
    }

.toggle-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin: 0;
}

/* The actual sliding switch mechanics */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    margin: 0;
}

    .switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s ease-in-out;
    border-radius: 20px;
}

    .toggle-slider:before {
        position: absolute;
        content: "";
        height: 14px;
        width: 14px;
        left: 3px;
        bottom: 3px;
        background-color: white;
        transition: .3s ease-in-out;
        border-radius: 50%;
        box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    }

/* When checked, turn blue and slide the white circle right */
.switch input:checked + .toggle-slider {
    background-color: #3b82f6;
}

    .switch input:checked + .toggle-slider:before {
        transform: translateX(16px);
    }

.title-with-reset {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .title-with-reset .btn-reset {
        margin-right: 5px; /* Gives it a little breathing room from the scrollbar */
    }

.icon {
    font-style: normal;
}




/* --- MOBILE SPECIFIC TWEAKS --- */
@media (max-width: 768px), (orientation: portrait) {
    /* Shrink everything by 15% on mobile screens */
    html {
        font-size: 12px; /* Standard is 16px */
    }

    /* Make the gaps between sliders a bit tighter on mobile */
    .tool-section {
        gap: 4px;
    }


    /* 🌟 FIX: Force the layout to stack vertically with the toolbar on bottom */
    .editor-layout {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100dvh !important;
        flex-direction: column-reverse !important;
        border-radius: 0 !important;
        z-index: 1000 !important;
        box-sizing: border-box !important;
        border: none !important;
        margin: 0 !important;
    }

    /* 🌟 FIX: Guarantee the canvas takes the top 55% of the screen */
    .workspace {
        width: 100% !important;
        height: 55% !important;
        padding: 15px !important;
        box-sizing: border-box !important;
    }

    /* Arrange bottom buttons in a single row */
    .tool-section.bottom {
        flex-direction: row !important;
        gap: 8px;
        padding-top: 15px;
    }

        /* Make them look like native app buttons (Icon on top, text below) */
        .tool-section.bottom .btn-tool {
            flex: 1;
            flex-direction: column;
            padding: 10px 4px;
            font-size: 0.7rem;
            text-align: center;
            justify-content: center;
            gap: 4px;
        }

            .tool-section.bottom .btn-tool .icon {
                font-size: 1.3rem;
                margin: 0;
            }
}

/* --- HISTORY PANEL (Undo / Redo) --- */
.history-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: #ffffff; /* 🌟 Matches Zoom Bar */
    border: 1px solid #d1d5db; /* 🌟 Matches Zoom Bar */
    border-radius: 8px; /* 🌟 Matches Zoom Bar */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); /* 🌟 Matches Zoom Bar */
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    z-index: 100;
    user-select: none;
}

    .history-panel .icon-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
        background-color: transparent !important;
    }

/* --- GLOBAL ICON BUTTONS (Used by Zoom & History Panels) --- */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #4b5563;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}

    .icon-btn:hover:not(:disabled) {
        background-color: #f3f4f6;
        color: #111827;
    }

    .icon-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }