/* ============================================
   Axioma Design System v2.0 — Snapi
   Premium SaaS — Azul profundo + Petróleo
   Local copy for PWA offline support
   ============================================ */

/* Reset */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* Design Tokens */
:root {
    /* Primary */
    --color-primary:       #1D2B4E;
    --color-primary-dark:  #0F1A33;

    /* Accent (Petróleo) */
    --color-accent:        #0F4C5C;
    --color-accent-hover:  #1B6B75;

    /* Background */
    --bg:             #F5F7FA;
    --bg-card:        #FFFFFF;
    --bg-elevated:    #FFFFFF;
    --bg-input:       #F0F2F5;
    --bg-hover:       #EEF0F4;

    /* Text */
    --text:           #0B1220;
    --text-secondary: #4B5563;
    --text-muted:     #9CA3AF;

    /* Borders */
    --border:         #E5E7EB;
    --border-light:   #F3F4F6;

    /* Shadows */
    --shadow-sm:      0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:      0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg:      0 8px 24px rgba(0,0,0,0.08);

    /* Status */
    --green:          #10b981;
    --red:            #ef4444;
    --yellow:         #f59e0b;
    --blue:           #3b82f6;

    /* Accent aliases (backwards compat) */
    --accent:         var(--color-primary);
    --accent-light:   rgba(29, 43, 78, 0.06);
    --accent-dark:    var(--color-primary-dark);
    --accent-glow:    rgba(15, 76, 92, 0.12);

    /* Layout */
    --header-height:  56px;
    --tab-bar-height: 56px;

    /* Radius */
    --radius:    12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

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

h1 { font-size: 2rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.3; }
h4 { font-size: 1rem; font-weight: 600; }

a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-hover); }

.text-accent { color: var(--color-accent); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-center { text-align: center; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.4;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--color-accent-hover); }
.btn-secondary { background: transparent; color: var(--color-primary); border: 1px solid var(--color-primary); }
.btn-secondary:hover:not(:disabled) { background: rgba(15, 76, 92, 0.08); }
.btn-outline { background: transparent; color: var(--color-primary); border: 1px solid var(--color-primary); }
.btn-outline:hover:not(:disabled) { background: rgba(29, 43, 78, 0.06); }
.btn-ghost { background: transparent; color: var(--text-secondary); padding: 8px 16px; }
.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: box-shadow 0.15s;
}
.card:hover { box-shadow: var(--shadow-md); }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-input, .form-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: inherit;
    font-size: 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-input::placeholder { color: var(--text-muted); }
textarea.form-input { resize: vertical; min-height: 80px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 4px; }
.form-input.error { border-color: var(--red); }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-accent { background: rgba(15, 76, 92, 0.10); color: var(--color-accent); }
.badge-green  { background: rgba(16, 185, 129, 0.10); color: var(--green); }
.badge-red    { background: rgba(239, 68, 68, 0.10); color: var(--red); }
.badge-yellow { background: rgba(245, 158, 11, 0.10); color: var(--yellow); }
.badge-blue   { background: rgba(59, 130, 246, 0.10); color: var(--blue); }
.badge-gray   { background: var(--bg-input); color: var(--text-muted); }

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-backdrop.active { display: flex; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-header h3 { margin: 0; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; padding: 4px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }

/* Toast */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    max-width: 360px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.warning { border-left: 3px solid var(--yellow); }
.toast.info    { border-left: 3px solid var(--color-accent); }
.toast-close { margin-left: auto; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 0 0 0 8px; line-height: 1; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Empty State */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state-title { font-size: 18px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-text { font-size: 14px; margin-bottom: 24px; max-width: 400px; margin-left: auto; margin-right: auto; }

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

.loading-overlay { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 9999; transition: opacity 0.3s; }
.loading-overlay.hidden { opacity: 0; pointer-events: none; }

/* Progress bar */
.progress { height: 8px; background: var(--bg-input); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--color-accent); border-radius: 4px; transition: width 0.3s ease; }
.progress-bar.green { background: var(--green); }
.progress-bar.red { background: var(--red); }
.progress-bar.yellow { background: var(--yellow); }

/* Containers */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 600px; margin: 0 auto; padding: 0 20px; }

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.flex-1 { flex: 1; }

/* Spacing */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

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

/* Responsive */
@media (max-width: 768px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.25rem; }
    .modal { padding: 24px; }
}

@media (max-width: 480px) {
    h1 { font-size: 1.5rem; }
    .container { padding: 0 16px; }
    .btn-lg { padding: 12px 24px; font-size: 15px; }
}
