/* ============================================================
   KMS Decryption Utility — Styles
   ============================================================ */

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.1);
    --primary-glow: rgba(99, 102, 241, 0.25);
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.1);
    --error: #ef4444;
    --error-light: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.1);
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-input: #232733;
    --bg-hover: #282c3a;
    --border: #2e3348;
    --border-focus: #6366f1;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Background gradient effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 500px;
    background: radial-gradient(ellipse at 50% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.app-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 20px;
    position: relative;
    z-index: 1;
}

/* ---- Header ---- */
.app-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.logo h1 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-align: left;
}

.logo .subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 400;
    text-align: left;
}

/* ---- Steps Bar ---- */
.steps-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 28px;
    padding: 0 10px;
}

.step {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.35;
    transition: var(--transition);
}

.step.active {
    opacity: 1;
}

.step.done {
    opacity: 0.7;
}

.step-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition);
    flex-shrink: 0;
}

.step.active .step-number {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 16px var(--primary-glow);
}

.step.done .step-number {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.step span {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.step.active span {
    color: var(--text);
}

.step-line {
    width: 40px;
    height: 2px;
    background: var(--border);
    margin: 0 6px;
    transition: var(--transition);
    flex-shrink: 0;
}

.step-line.done {
    background: var(--success);
}

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 24px 24px 0 24px;
}

.card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.credentials-icon {
    background: var(--primary-light);
    color: var(--primary);
}

.verify-icon {
    background: var(--success-light);
    color: var(--success);
}

.file-icon {
    background: var(--warning-light);
    color: var(--warning);
}

.success-icon {
    background: var(--success-light);
    color: var(--success);
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.card-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.card-body {
    padding: 20px 24px 24px 24px;
}

/* ---- Form ---- */
.form-group {
    margin-bottom: 16px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 70px;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 32px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: var(--transition);
}

.toggle-password:hover {
    color: var(--text);
}

/* ---- Buttons ---- */
.btn {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    margin-top: 8px;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 4px 16px var(--primary-glow);
    transform: translateY(-1px);
}

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

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    margin-top: 10px;
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.btn-download {
    background: linear-gradient(135deg, var(--success), #059669);
    font-size: 1rem;
    padding: 14px 24px;
}

.btn-download:hover:not(:disabled) {
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

.btn-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-loader {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---- Spinner ---- */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ---- Verification Results ---- */
.verification-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.verify-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.verify-item strong {
    font-size: 0.88rem;
    display: block;
    margin-bottom: 2px;
}

.verify-item p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.verify-status {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.verify-status.success {
    background: var(--success-light);
    color: var(--success);
}

.verify-status.error {
    background: var(--error-light);
    color: var(--error);
}

/* ---- Dropzone ---- */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 8px;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.dropzone-icon {
    color: var(--text-muted);
    margin-bottom: 12px;
}

.dropzone:hover .dropzone-icon,
.dropzone.dragover .dropzone-icon {
    color: var(--primary);
}

.dropzone-text {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.dropzone-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.dropzone-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary);
}

.file-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
}

.file-size {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.btn-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: var(--transition);
}

.btn-remove:hover {
    color: var(--error);
}

/* ---- Success Box ---- */
.success-box {
    text-align: center;
    padding: 24px;
    margin-bottom: 16px;
    background: var(--bg-input);
    border-radius: var(--radius);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.success-animation {
    margin-bottom: 16px;
    animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.success-details {
    text-align: left;
    display: inline-block;
}

.success-details p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.success-details strong {
    color: var(--text-muted);
}

.success-details span {
    color: var(--text);
    font-weight: 500;
}

/* ---- Toast ---- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s;
    opacity: 0;
    max-width: 500px;
    width: 90%;
}

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

.toast p {
    font-size: 0.85rem;
    color: var(--text);
}

.toast.toast-error {
    border-color: rgba(239, 68, 68, 0.3);
}

.toast.toast-success {
    border-color: rgba(16, 185, 129, 0.3);
}

/* ---- Footer ---- */
.app-footer {
    text-align: center;
    margin-top: 32px;
    padding: 16px 0;
}

.app-footer p {
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.05em;
}

.app-footer code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    color: var(--primary);
}

/* ---- Utility ---- */
.hidden {
    display: none !important;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .app-container {
        padding: 16px 12px;
    }

    .card-header {
        padding: 18px 18px 0 18px;
    }

    .card-body {
        padding: 16px 18px 18px 18px;
    }

    .logo h1 {
        font-size: 1.15rem;
    }

    .step span {
        display: none;
    }

    .step-line {
        width: 24px;
    }

    .dropzone {
        padding: 28px 16px;
    }
}
