﻿/* ========================================
   4EverFile — Reusable Components
   ======================================== */

/* ---- Cards ---- */
.card {
    background: var(--fs-gradient-card);
    border: 1px solid var(--fs-border);
    border-radius: var(--fs-radius-lg);
    padding: var(--fs-spacing-lg);
    transition: all var(--fs-transition-base);
}
.card:hover {
    border-color: var(--fs-border-strong);
    box-shadow: var(--fs-shadow-md);
}

.card-glass {
    background: var(--fs-glass);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--fs-glass-border);
    border-radius: var(--fs-radius-lg);
    padding: var(--fs-spacing-lg);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--fs-spacing-sm);
    padding: 10px 20px;
    border-radius: var(--fs-radius-md);
    font-family: var(--fs-font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--fs-transition-fast);
    text-decoration: none;
    line-height: 1;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--fs-gradient-primary);
    color: white;
    box-shadow: 0 2px 8px var(--fs-accent-glow);
}
.btn-primary:hover {
    box-shadow: 0 4px 16px var(--fs-accent-glow);
    filter: brightness(1.1);
}

.btn-secondary {
    background: var(--fs-bg-elevated);
    color: var(--fs-text-primary);
    border: 1px solid var(--fs-border);
}
.btn-secondary:hover {
    background: var(--fs-bg-hover);
    border-color: var(--fs-border-strong);
}

.btn-success {
    background: var(--fs-gradient-success);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--fs-text-secondary);
    padding: 8px 12px;
}
.btn-ghost:hover {
    background: var(--fs-bg-hover);
    color: var(--fs-text-primary);
}

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

/* ---- Inputs ---- */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--fs-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input {
    background: var(--fs-bg-input);
    border: 1px solid var(--fs-border);
    border-radius: var(--fs-radius-md);
    padding: 10px 14px;
    color: var(--fs-text-primary);
    font-family: var(--fs-font-sans);
    font-size: 0.9rem;
    transition: all var(--fs-transition-fast);
    outline: none;
    width: 100%;
}
.input:focus {
    border-color: var(--fs-accent);
    box-shadow: 0 0 0 3px var(--fs-accent-glow);
}
.input::placeholder { color: var(--fs-text-muted); }

select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.input {
    min-height: 100px;
    resize: vertical;
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--fs-radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success {
    background: var(--fs-success-glow);
    color: var(--fs-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-warning {
    background: var(--fs-warning-glow);
    color: var(--fs-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-error {
    background: var(--fs-error-glow);
    color: var(--fs-error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.badge-info {
    background: rgba(6, 182, 212, 0.15);
    color: var(--fs-info);
    border: 1px solid rgba(6, 182, 212, 0.3);
}
.badge-accent {
    background: var(--fs-accent-subtle);
    color: var(--fs-accent);
    border: 1px solid var(--fs-border);
}

/* ---- Hash Display ---- */
.hash-display {
    font-family: var(--fs-font-mono);
    font-size: 0.8rem;
    background: var(--fs-bg-input);
    border: 1px solid var(--fs-border);
    border-radius: var(--fs-radius-sm);
    padding: 8px 12px;
    word-break: break-all;
    color: var(--fs-text-accent);
    position: relative;
}
.hash-display .copy-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--fs-bg-elevated);
    border: 1px solid var(--fs-border);
    color: var(--fs-text-secondary);
    padding: 4px 8px;
    border-radius: var(--fs-radius-sm);
    font-size: 0.7rem;
    cursor: pointer;
}
.hash-display .copy-btn:hover { color: var(--fs-accent); }

/* ---- Anchor Status ---- */
.anchor-status {
    display: flex;
    align-items: center;
    gap: var(--fs-spacing-md);
}

.anchor-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: relative;
}
.anchor-dot.verified {
    background: var(--fs-success);
    box-shadow: 0 0 8px var(--fs-success-glow);
}
.anchor-dot.verified::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid var(--fs-success);
    opacity: 0.3;
    animation: pulse-ring 2s ease-out infinite;
}
.anchor-dot.pending {
    background: var(--fs-warning);
    animation: pulse 1.5s ease-in-out infinite;
}
.anchor-dot.failed { background: var(--fs-error); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 0.3; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* ---- Upload Drop Zone ---- */
.drop-zone {
    border: 2px dashed var(--fs-border-strong);
    border-radius: var(--fs-radius-xl);
    padding: var(--fs-spacing-2xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--fs-transition-base);
    background: var(--fs-accent-subtle);
}
.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--fs-accent);
    background: rgba(59, 130, 246, 0.1);
    box-shadow: inset 0 0 30px var(--fs-accent-glow);
}
.drop-zone .drop-icon {
    font-size: 3rem;
    margin-bottom: var(--fs-spacing-md);
    opacity: 0.6;
}
.drop-zone .drop-text {
    font-size: 1.1rem;
    color: var(--fs-text-secondary);
}
.drop-zone .drop-hint {
    font-size: 0.8rem;
    color: var(--fs-text-muted);
    margin-top: var(--fs-spacing-sm);
}

/* ---- Progress Bar ---- */
.progress-bar {
    height: 6px;
    background: var(--fs-bg-input);
    border-radius: var(--fs-radius-full);
    overflow: hidden;
}
.progress-bar .progress-fill {
    height: 100%;
    background: var(--fs-gradient-primary);
    border-radius: var(--fs-radius-full);
    transition: width var(--fs-transition-base);
}

/* ---- Tables ---- */
.table-container { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--fs-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--fs-border);
    background: var(--fs-bg-secondary);
}
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--fs-border-subtle);
    font-size: 0.9rem;
}
.data-table tr:hover td {
    background: var(--fs-bg-hover);
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: var(--fs-spacing-2xl);
    color: var(--fs-text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: var(--fs-spacing-md); opacity: 0.4; }
.empty-state .empty-title { font-size: 1.2rem; color: var(--fs-text-secondary); margin-bottom: var(--fs-spacing-sm); }

/* ---- Toast Notifications ---- */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: var(--fs-glass);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid var(--fs-glass-border);
    border-radius: var(--fs-radius-md);
    padding: 14px 20px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}
.toast.success { border-left: 3px solid var(--fs-success); }
.toast.error { border-left: 3px solid var(--fs-error); }
.toast.warning { border-left: 3px solid var(--fs-warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---- Signature Canvas ---- */
.signature-canvas-container {
    border: 2px solid var(--fs-border);
    border-radius: var(--fs-radius-lg);
    background: #ffffff;
    overflow: hidden;
    position: relative;
}
.signature-canvas-container canvas {
    display: block;
    cursor: crosshair;
}
.signature-canvas-actions {
    display: flex;
    gap: var(--fs-spacing-sm);
    padding: var(--fs-spacing-sm);
    background: var(--fs-bg-elevated);
    border-top: 1px solid var(--fs-border);
}

/* ---- Blockchain Proof Card ---- */
.proof-card {
    background: var(--fs-bg-elevated);
    border: 1px solid var(--fs-border);
    border-radius: var(--fs-radius-lg);
    overflow: hidden;
}
.proof-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--fs-accent-subtle);
    border-bottom: 1px solid var(--fs-border);
    cursor: pointer;
}
.proof-card-header .proof-network {
    font-weight: 600;
    font-size: 0.9rem;
}
.proof-card-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.proof-card-body .proof-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.proof-card-body .proof-label {
    font-size: 0.8rem;
    color: var(--fs-text-muted);
    text-transform: uppercase;
}
.proof-card-body .proof-value {
    font-family: var(--fs-font-mono);
    font-size: 0.8rem;
    color: var(--fs-text-accent);
}

/* ---- Loading Spinner ---- */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--fs-border);
    border-top-color: var(--fs-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.spinner-lg {
    width: 32px;
    height: 32px;
    margin: 0 auto 16px;
}

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal {
    background: var(--fs-bg-secondary);
    border: 1px solid var(--fs-border);
    border-radius: var(--fs-radius-xl);
    padding: var(--fs-spacing-xl);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn 0.25s ease;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--fs-spacing-lg);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
