/* ============================================
   gmm-toolbar.css
   GMM Toolbar (Give Me More) -- dual-handle range slider for clip
   boundary adjustment, edited-clip players, progress + error states.
   Extracted verbatim from stronghold.css (m25.22-thumb-snatch ready-room).
   Linked globally via base.html (same load scope as before).
   ============================================ */

/* ================================
   GMM Toolbar (Give Me More)
   Dual-handle range slider for clip boundary adjustment
   m18.gmm.7
   ================================ */

/* Base container -- hidden by default, slides in */
.gmm-toolbar {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 13px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.25s ease, max-height 0.3s ease, padding 0.3s ease;
    padding-top: 0;
    padding-bottom: 0;
}

.gmm-toolbar.visible {
    opacity: 1;
    max-height: 300px;
    padding: 12px 16px;
    animation: gmm-slide-in 0.3s ease forwards;
    /* Once expanded, allow the frame-preview popover (rendered bottom:100% above
       the slider) to escape the toolbar's top edge. The base .gmm-toolbar keeps
       overflow:hidden so the max-height collapse animation still clips cleanly. */
    overflow: visible;
}

@keyframes gmm-slide-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header: title + duration */
.gmm-toolbar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.gmm-toolbar__title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gmm-toolbar__duration {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: Monaco, Menlo, 'Courier New', monospace;
}

.gmm-toolbar--dirty .gmm-toolbar__duration {
    color: #3b82f6;
}

/* Slider container */
.gmm-toolbar__slider {
    position: relative;
    margin-bottom: 6px;
}

/* Track */
/* m25.thumb-sprite.11: taller so the 16:9 sprite-rail tiles read as proper frames
   instead of a vertically-squished filmstrip (the zones/handles/needle all flex to
   the track height, so only this value + the handle height change). */
.gmm-toolbar__track {
    position: relative;
    height: 56px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
}

/* Visual zones (all absolutely positioned inside track) */
.gmm-toolbar__zone {
    position: absolute;
    top: 0;
    height: 100%;
    pointer-events: none;
    transition: left 0.05s ease, width 0.05s ease;
}

/* Before zone: hatched gray (out of selection, before start) */
.gmm-toolbar__zone--before {
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 3px,
        rgba(64, 64, 64, 0.3) 3px,
        rgba(64, 64, 64, 0.3) 6px
    );
}

/* After zone: hatched gray (out of selection, after end) */
.gmm-toolbar__zone--after {
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 3px,
        rgba(64, 64, 64, 0.3) 3px,
        rgba(64, 64, 64, 0.3) 6px
    );
}

/* Original zone: emerald green */
.gmm-toolbar__zone--original {
    background: rgba(16, 185, 129, 0.25);
    border-left: 1px solid rgba(16, 185, 129, 0.4);
    border-right: 1px solid rgba(16, 185, 129, 0.4);
}

/* Extension left: blue (expanded before original start) */
.gmm-toolbar__zone--extension-left {
    background: rgba(59, 130, 246, 0.3);
    border-left: 1px solid rgba(59, 130, 246, 0.5);
}

/* Extension right: blue (expanded past original end) */
.gmm-toolbar__zone--extension-right {
    background: rgba(59, 130, 246, 0.3);
    border-right: 1px solid rgba(59, 130, 246, 0.5);
}

/* Handles */
.gmm-toolbar__handle {
    position: absolute;
    top: -2px;
    width: 10px;
    height: 60px; /* track 56px + 2px overhang top/bottom (m25.thumb-sprite.11) */
    background: var(--text-primary);
    border-radius: 3px;
    cursor: ew-resize;
    transform: translateX(-50%);
    z-index: 10;
    transition: left 0.05s ease, background 0.15s ease;
}

.gmm-toolbar__handle:hover {
    background: #3b82f6;
}

.gmm-toolbar__handle:active,
.gmm-toolbar--dragging .gmm-toolbar__handle {
    background: #3b82f6;
}

/* Handle notch (grip lines) */
.gmm-toolbar__handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 12px;
    border-left: 1px solid rgba(0, 0, 0, 0.4);
    border-right: 1px solid rgba(0, 0, 0, 0.4);
}

.gmm-toolbar__handle--start {
    /* Left handle: inherits base styles */
}

.gmm-toolbar__handle--end {
    /* Right handle: inherits base styles */
}

/* Labels row: delta start / delta end */
.gmm-toolbar__labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 0 2px;
}

.gmm-toolbar__delta {
    font-size: 11px;
    font-family: Monaco, Menlo, 'Courier New', monospace;
    color: var(--text-secondary);
}

.gmm-toolbar__delta--start {
    text-align: left;
}

.gmm-toolbar__delta--end {
    text-align: right;
}

.gmm-toolbar__delta--negative {
    color: #ef4444;
}

.gmm-toolbar__delta--positive {
    color: #10b981;
}

.gmm-toolbar__delta--zero {
    color: var(--text-secondary);
}

/* Quick-adjust row (Start buttons | Reset/Apply | End buttons) */
.gmm-toolbar__quick-adjust {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.gmm-toolbar__quick-adjust-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.gmm-toolbar__quick-adjust-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 30px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.gmm-toolbar__quick-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-family: Monaco, Menlo, 'Courier New', monospace;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    line-height: 1.4;
}

.gmm-toolbar__quick-btn:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

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

.gmm-toolbar__quick-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Action buttons (inline between Start/End quick-adjust groups) */
.gmm-toolbar__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.gmm-toolbar__reset {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.gmm-toolbar__reset:hover:not(:disabled) {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.gmm-toolbar__reset:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.gmm-toolbar__apply {
    background: #10b981;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 6px 18px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.gmm-toolbar__apply:hover:not(:disabled) {
    background: #059669;
}

.gmm-toolbar__apply:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Apply button loading state */
.gmm-toolbar__apply-spinner {
    display: none;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: gmm-spin 0.6s linear infinite;
}

.gmm-toolbar__apply--loading .gmm-toolbar__apply-spinner {
    display: inline-block;
}

.gmm-toolbar__apply--loading .gmm-toolbar__apply-text {
    opacity: 0.7;
}

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

/* GMM Tool Button States (m18.gmm.8) */
.gmm-tool-btn.active {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border: 1px solid #3b82f6;
}

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

/* GMM Edited Player Row (m18.gmm.9.1) */
.gmm-edited-player-row {
    margin-top: 12px;
    padding-top: 12px;
    padding-bottom: 16px;
    border-top: 1px solid rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.03);
    border-radius: 0 0 8px 8px;
    padding-left: 12px;
    padding-right: 12px;
}

.gmm-edited-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

/* M18.gmm.10: Download buttons for edited clips */
.gmm-edited-download-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.gmm-edited-download-btn {
    color: white;
    font-weight: 500;
    font-size: 12px;
    height: 28px;
    padding: 0 10px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.gmm-edited-download-btn--landscape {
    background-color: #059669;
}

.gmm-edited-download-btn--landscape:hover {
    background-color: #047857;
}

.gmm-edited-download-btn--vertical {
    background-color: #a855f7;
}

.gmm-edited-download-btn--vertical:hover {
    background-color: #9333ea;
}

.gmm-edited-download-btn--share {
    background-color: #3b82f6;
}

.gmm-edited-download-btn--share:hover {
    background-color: #2563eb;
}

.gmm-edited-badge {
    letter-spacing: 0.03em;
}

.gmm-edited-players {
    display: flex;
    gap: 16px;
    width: 100%;
    justify-content: space-between;
    align-items: flex-start;
}

.gmm-edited-landscape {
    flex: 1;
    min-width: 600px;
    background: black;
    border-radius: 8px;
}

.gmm-edited-vertical {
    width: 225px;
    height: 400px;
    flex-shrink: 0;
    background: black;
    border-radius: 8px;
    overflow: hidden;
    margin-left: auto;
}

/* ================================
   M18.gmm.9: GMM Progress Bar & Error Styles
   ================================ */

/* Progress container */
.gmm-toolbar__progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

/* Progress bar track */
.gmm-toolbar__progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    overflow: hidden;
}

/* Progress bar fill */
.gmm-toolbar__progress-fill {
    height: 100%;
    width: 0%;
    background: #10b981;
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Progress text */
.gmm-toolbar__progress-text {
    font-size: 11px;
    font-family: Monaco, Menlo, 'Courier New', monospace;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 120px;
}

/* GMM error banner */
.gmm-toolbar__error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 8px;
    font-size: 12px;
    color: #f87171;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: gmm-error-slide-in 0.2s ease-out;
}

@keyframes gmm-error-slide-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
