/**
 * Adobe-Style Toolbar System
 * Professional toolbars for PDF editing tools
 */

/* ========================================
   Main Toolbar Container
   ======================================== */

.adobe-toolbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    position: sticky;
    top: 56px;
    z-index: 999;
    box-shadow: var(--shadow-sm);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    border-right: 1px solid var(--border-color);
}

.toolbar-group:last-child {
    border-right: none;
}

.toolbar-group:first-child {
    padding-left: 0;
}

/* ========================================
   Toolbar Buttons - Adobe Style
   ======================================== */

.toolbar-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    position: relative;
}

.toolbar-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.toolbar-btn:hover {
    background: var(--hover-bg);
    color: var(--accent-primary);
}

.toolbar-btn:active {
    transform: scale(0.95);
}

.toolbar-btn.active {
    background: var(--hover-bg);
    color: var(--accent-primary);
}

.toolbar-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.toolbar-btn:disabled:hover {
    background: transparent;
    color: var(--text-secondary);
    transform: none;
}

/* Toolbar button with label */
.toolbar-btn-labeled {
    width: auto;
    padding: 0 12px;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
}

.toolbar-btn-labeled span {
    white-space: nowrap;
}

/* ========================================
   Toolbar Inputs & Selects
   ======================================== */

.toolbar-input,
.toolbar-select {
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: all 0.15s ease;
    min-width: 60px;
}

.toolbar-input:focus,
.toolbar-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--hover-bg);
}

.toolbar-input::placeholder {
    color: var(--text-muted);
}

/* Color picker toolbar style */
.toolbar-color {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    transition: all 0.15s ease;
}

.toolbar-color:hover {
    border-color: var(--accent-primary);
}

/* ========================================
   Toolbar Labels
   ======================================== */

.toolbar-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    user-select: none;
}

/* ========================================
   Toolbar Separator
   ======================================== */

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 4px;
}

/* ========================================
   Dropdown Menus (Adobe Style)
   ======================================== */

.toolbar-dropdown {
    position: relative;
    display: inline-block;
}

.toolbar-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.toolbar-dropdown-btn:hover {
    background: var(--hover-bg);
    color: var(--accent-primary);
}

.toolbar-dropdown-btn::after {
    content: '▼';
    font-size: 9px;
    margin-left: 2px;
    transition: transform 0.15s ease;
}

.toolbar-dropdown.open .toolbar-dropdown-btn::after {
    transform: rotate(180deg);
}

.toolbar-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 4px;
    display: none;
    z-index: 1000;
}

.toolbar-dropdown.open .toolbar-dropdown-menu {
    display: block;
}

.toolbar-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.toolbar-dropdown-item:hover {
    background: var(--hover-bg);
    color: var(--accent-primary);
}

.toolbar-dropdown-item svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.toolbar-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* ========================================
   Property Panel (Adobe Style)
   ======================================== */

.property-panel {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    width: 280px;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.property-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.property-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.property-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.property-row-horizontal {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.property-row-triple {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.property-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ========================================
   Slider Control (Adobe Style)
   ======================================== */

.toolbar-slider-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px;
}

.toolbar-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100px;
    height: 4px;
    background: var(--bg-accent);
    border-radius: 2px;
    outline: none;
}

.toolbar-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
}

.toolbar-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px var(--hover-bg);
}

.toolbar-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}

.toolbar-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px var(--hover-bg);
}

.toolbar-slider-value {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 32px;
    text-align: right;
}

/* ========================================
   Toggle Switch (Adobe Style)
   ======================================== */

.toolbar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.toolbar-toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--bg-accent);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.toolbar-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toolbar-toggle input {
    display: none;
}

.toolbar-toggle input:checked + .toolbar-toggle-switch {
    background: var(--accent-primary);
}

.toolbar-toggle input:checked + .toolbar-toggle-switch::after {
    left: 18px;
}

.toolbar-toggle-label {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

/* ========================================
   Tooltips
   ======================================== */

.toolbar-btn[data-tooltip]:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 11px;
    white-space: nowrap;
    border-radius: 4px;
    margin-bottom: 6px;
    box-shadow: var(--shadow-md);
    z-index: 1001;
    pointer-events: none;
}

/* ========================================
   Tool Icons (SVG)
   ======================================== */

.toolbar-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

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

@media (max-width: 900px) {
    .adobe-toolbar {
        padding: 6px 8px;
        gap: 4px;
    }

    .toolbar-group {
        padding: 0 4px;
    }

    .toolbar-btn {
        width: 28px;
        height: 28px;
    }

    .toolbar-btn svg {
        width: 18px;
        height: 18px;
    }

    .toolbar-btn-labeled span {
        display: none;
    }

    .property-panel {
        width: 240px;
        padding: 12px;
    }
}

@media (max-width: 640px) {
    .adobe-toolbar {
        top: 56px;
    }

    .property-panel {
        position: fixed;
        top: 0;
        bottom: 0;
        right: -280px;
        z-index: 1100;
        transition: right 0.3s ease;
        box-shadow: var(--shadow-xl);
    }

    .property-panel.open {
        right: 0;
    }

    .toolbar-group {
        gap: 2px;
    }
}

/* ========================================
   Loading State
   ======================================== */

.toolbar-btn.loading {
    pointer-events: none;
    opacity: 0.5;
}

.toolbar-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid var(--accent-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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