/**
 * UbdosAtlas Undo/Redo UI Styles
 * 
 * Styling for the undo/redo buttons and history panel.
 * @version 3.0.0
 */

/* ========================================
   Undo/Redo Buttons in Edit Bar
   ======================================== */

#undo-redo-buttons {
    display: inline-flex;
    gap: 4px;
    margin-right: 10px;
    padding-right: 10px;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

#undo-redo-buttons button {
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: #00d4ff;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

#undo-redo-buttons button:hover:not(:disabled) {
    background: rgba(0, 212, 255, 0.3);
    border-color: rgba(0, 212, 255, 0.5);
}

#undo-redo-buttons button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#undo-redo-buttons button i {
    font-size: 0.9rem;
}

#undo-redo-buttons .undo-count,
#undo-redo-buttons .redo-count {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-left: 2px;
}

/* Tooltips for undo/redo */
#undo-redo-buttons button[title] {
    position: relative;
}

/* ========================================
   History Panel (Optional Advanced View)
   ======================================== */

#history-panel {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a2e;
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    width: 350px;
    max-height: 400px;
    overflow: hidden;
    display: none;
    z-index: 2000;
}

#history-panel.active {
    display: block;
}

#history-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #16213e;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#history-panel-header h3 {
    margin: 0;
    font-size: 0.95rem;
    color: #00d4ff;
}

#history-panel-header button {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    line-height: 1;
}

#history-panel-header button:hover {
    color: #fff;
}

#history-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 4px 0;
    background: #16213e;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.history-item:hover {
    background: #0f3460;
}

.history-item.current {
    border-left: 3px solid #00d4ff;
    background: rgba(0, 212, 255, 0.1);
}

.history-item.future {
    opacity: 0.5;
}

.history-item-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.history-item-icon.add { background: rgba(74, 222, 128, 0.2); color: #4ade80; }
.history-item-icon.delete { background: rgba(248, 113, 113, 0.2); color: #f87171; }
.history-item-icon.edit { background: rgba(0, 212, 255, 0.2); color: #00d4ff; }
.history-item-icon.merge { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.history-item-icon.split { background: rgba(168, 85, 247, 0.2); color: #a855f7; }

.history-item-text {
    flex: 1;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-time {
    font-size: 0.7rem;
    color: #888;
}

/* History panel footer */
#history-panel-footer {
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
    background: #16213e;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#history-panel-footer button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #aaa;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

#history-panel-footer button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ========================================
   Keyboard Shortcut Hints
   ======================================== */

.shortcut-hint {
    font-size: 0.65rem;
    opacity: 0.6;
    margin-left: 8px;
    padding: 2px 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    font-family: 'Consolas', monospace;
}

/* ========================================
   Notification Toast for Undo/Redo
   ======================================== */

#action-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1a1a2e;
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    padding: 12px 20px;
    color: #fff;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2000;
}

#action-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#action-toast.success {
    border-color: rgba(74, 222, 128, 0.5);
}

#action-toast.error {
    border-color: rgba(248, 113, 113, 0.5);
}

#action-toast i {
    font-size: 1.1rem;
}

#action-toast.success i { color: #4ade80; }
#action-toast.error i { color: #f87171; }
#action-toast i.undo { color: #fbbf24; }
#action-toast i.redo { color: #00d4ff; }

/* ========================================
   Add Island / Split Mode Overlays
   ======================================== */

#add-island-overlay,
#split-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 212, 255, 0.15);
    padding: 10px 20px;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1500;
    backdrop-filter: blur(2px);
}

#add-island-overlay.active,
#split-overlay.active {
    display: flex;
}

.add-island-message,
.split-message {
    background: #1a1a2e;
    border: 1px solid #00d4ff;
    border-radius: 8px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-size: 0.9rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.add-island-message i,
.split-message i {
    color: #00d4ff;
    font-size: 1.2rem;
}

.add-island-message button,
.split-message button {
    background: #f87171;
    border: none;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 10px;
}

.add-island-message button:hover,
.split-message button:hover {
    background: #ef4444;
}

/* ========================================
   Merge Modal Enhancement
   ======================================== */

.merge-candidate {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #16213e;
    border-radius: 4px;
    margin: 4px 0;
    cursor: pointer;
    transition: all 0.15s;
}

.merge-candidate:hover {
    background: #0f3460;
}

.merge-candidate input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #00d4ff;
}

.merge-candidate .candidate-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.merge-candidate .candidate-name {
    flex: 1;
    font-weight: 500;
}

.merge-candidate .candidate-district {
    font-size: 0.8rem;
    color: #888;
}
