﻿/* =========================================================
   DRAFT RESTORE MODAL + STATUS SYSTEM (Unified + Optimized)
   ========================================================= */

/* ==============================
   MODAL BASE
   ============================== */
.draft-restore-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
    
}

.draft-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}

.draft-modal-content {
    position: relative;
    background: #fff;
    border-radius: 7px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    padding: 20px 30px;
    animation: slideUp 0.4s ease-out;
}

.draft-modal-header {
    margin-bottom: 24px;
    text-align: center;
}

    .draft-modal-header h3 {
        font-size: 24px;
        font-weight: 700;
        color: #111827;
        margin: 0 0 8px;
    }

    .draft-modal-header p {
        font-size: 15px;
        color: #6b7280;
        margin: 0;
    }

/* ==============================
   WARNING + COMPARISON
   ============================== */
.draft-age-warning {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s ease-out 0.2s both;
}

.draft-age-warning-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.draft-age-warning-text {
    font-size: 14px;
    color: #92400e;
    line-height: 1.5;
}

.draft-age-warning strong {
    display: block;
    font-weight: 600;
    margin-bottom: 2px;
}

/* ==============================
   COMPARISON DETAILS
   ============================== */
.draft-comparison {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.draft-info,
.server-info {
    background: #f9fafb;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.draft-info {
    background-color: transparent;
}

.server-info {
    background-color: transparent;
}

    .draft-info:hover,
    .server-info:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .draft-info strong,
    .server-info strong {
        display: block;
        font-size: 13px;
        font-weight: 600;
        margin-bottom: 12px;
        color: #374151;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

.draft-timestamp,
.server-timestamp {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.draft-details,
.server-details {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.6;
}

/* Detail list */
.draft-details-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
}

    .draft-details-list li {
        padding: 4px 0;
        display: flex;
        align-items: center;
        gap: 8px;
    }

        .draft-details-list li::before {
            content: '•';
            color: #f59e0b;
            font-weight: bold;
            font-size: 16px;
        }

/* Change badges */
.draft-change-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 4px;
}

.draft-change-badge--added {
    background: #d1fae5;
    color: #065f46;
}

.draft-change-badge--removed {
    background: #fee2e2;
    color: #991b1b;
}

.draft-change-badge--modified {
    background: #dbeafe;
    color: #1e40af;
}

/* ==============================
   MODAL ACTIONS + BUTTONS
   ============================== */
.draft-modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.draft-btn {
    flex: 1;
    padding: 10px 14px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.draft-btn-primary {
    background: #444;
    color: white;
}

    .draft-btn-primary:hover {
        background: #222;
        
    }

.draft-btn-danger {
    background: #fff;
    color: #dc2626;
    border: 2px solid #fecaca;
}

    .draft-btn-danger:hover {
        border-color: #dc2626;
    }

.draft-btn:active {
    transform: translateY(0);
}

/* ==============================
   STATUS INDICATOR + TOOLTIP
   ============================== */
.draft-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 2px 8px;
    font-size: 14px;
    font-weight: 500;
    background: #f3f4f6;
    color: #6b7280;
    transition: all 0.3s ease;
    cursor: help;
    border-radius: 4px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

    .draft-status:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    }

.draft-status-icon {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.draft-status-text {
    font-size: 13px;
    line-height: 1;
}

/* STATES */
.draft-status--ready {
    background: #f3f4f6;
    color: #6b7280;
}

.draft-status--unsaved {
    background: #fef3c7;
    color: #92400e;
    animation: pulse-subtle 2s ease-in-out infinite;
}

    .draft-status--unsaved .draft-status-icon {
        animation: bounce-gentle 1s ease-in-out infinite;
    }

.draft-status--saving {
    background: #dbeafe;
    color: #1e40af;
}

    .draft-status--saving .draft-status-icon {
        animation: spin 1s linear infinite;
    }

.draft-status--saved {
    background: #003f0c;
    color: #eee;
    animation: flash-success 0.5s ease-out;
}

    .draft-status--saved .draft-status-icon {
        animation: check-pop 0.5s ease-out;
    }

.draft-status--error {
    background: #fee2e2;
    color: #991b1b;
}

    .draft-status--error .draft-status-icon {
        animation: shake 0.5s ease-in-out;
    }

/* Tooltip */
.draft-status-tooltip {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

    .draft-status-tooltip::after {
        content: '';
        position: absolute;
        top: -12px;
        left: 50%;
        transform: translateX(-50%);
        border-width: 6px;
        border-style: solid;
        border-color: transparent transparent #1f2937 transparent;
    }

.draft-status:hover .draft-status-tooltip {
    opacity: 1;
    visibility: visible;
}

.draft-status-tooltip strong {
    display: block;
    margin-bottom: 4px;
    color: #60a5fa;
}

/* ==============================
   ANIMATIONS
   ============================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse-subtle {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.85;
    }
}

@keyframes bounce-gentle {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes flash-success {
    0% {
        background: #d1fae5;
    }

    50% {
        background: #6ee7b7;
    }

    100% {
        background: #d1fae5;
    }
}

@keyframes check-pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* ==============================
   RESPONSIVE
   ============================== */
@media (max-width: 640px) {
    .draft-modal-content {
        padding: 24px;
        max-width: 95%;
    }

    .draft-comparison {
        flex-direction: column;
    }

    .draft-modal-actions {
        flex-direction: column;
    }

    .draft-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==============================
   ACCESSIBILITY + REDUCED MOTION
   ============================== */
.draft-btn:focus-visible,
.draft-status:focus-visible {
    outline: 3px solid #60a5fa;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}
