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

/* Variables */
:root {
    --green-500: #10B981;
    --green-600: #059669;
    --green-700: #047857;
    --green-50: #F0FDF4;
    --green-100: #DCFCE7;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --blue-500: #3B82F6;
    --blue-50: #EFF6FF;
    --amber-500: #F59E0B;
    --amber-600: #D97706;
    --red-500: #EF4444;
    --red-50: #FEE2E2;
    --red-600: #DC2626;
    --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

body {
    font-family: var(--font);
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: var(--green-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Typography */
h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 700; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-muted { color: var(--gray-500); }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

/* Layout */
.container { max-width: 480px; margin: 0 auto; padding: 24px 16px; }
.container-sm { max-width: 400px; margin: 0 auto; padding: 24px 16px; }
.container-wide { max-width: 800px; margin: 0 auto; padding: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: 4px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.gap-xl { gap: 32px; }
.w-full { width: 100%; }
.flex-1 { flex: 1; }

/* Page center */
.page-center {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    padding: 24px;
}
.card-sm { padding: 16px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    text-decoration: none;
    font-family: var(--font);
    line-height: 1;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--green-500); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--green-600); }
.btn-amber { background: var(--amber-500); color: white; }
.btn-amber:hover:not(:disabled) { background: var(--amber-600); }
.btn-blue { background: var(--blue-500); color: white; }
.btn-danger { background: transparent; color: var(--red-500); border: 1px solid var(--red-500); }
.btn-danger:hover:not(:disabled) { background: var(--red-50); }
.btn-outline { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover:not(:disabled) { background: var(--gray-100); }
.btn-sm { padding: 8px 16px; font-size: 0.875rem; }
.btn-xs { padding: 6px 12px; font-size: 0.75rem; }
.btn-icon {
    width: 40px; height: 40px; padding: 0;
    border-radius: 50%; background: transparent; border: none;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    color: white; font-size: 1.25rem;
    transition: background 0.15s;
}
.btn-icon:hover { background: rgba(255,255,255,0.15); }

/* Form inputs */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.input-label { font-size: 0.875rem; font-weight: 600; color: var(--gray-700); }
.input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: white;
    color: var(--gray-900);
}
.input:focus { border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(16,185,129,0.1); }
.input::placeholder { color: var(--gray-400); }
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn .input { flex: 1; }

/* Toggle switch */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.toggle-label { font-size: 0.9rem; color: var(--gray-700); }
.toggle {
    position: relative; width: 48px; height: 26px;
    background: var(--gray-300); border-radius: 13px;
    cursor: pointer; transition: background 0.2s;
    border: none; padding: 0;
}
.toggle.active { background: var(--green-500); }
.toggle::after {
    content: ''; position: absolute;
    width: 22px; height: 22px; border-radius: 50%;
    background: white; top: 2px; left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle.active::after { transform: translateX(22px); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.875rem; }
.alert-error { background: var(--red-50); color: var(--red-600); border: 1px solid #FCA5A5; }
.alert-success { background: var(--green-50); color: var(--green-600); border: 1px solid #BBF7D0; }
.alert-info { background: var(--blue-50); color: var(--blue-500); border: 1px solid #93C5FD; }

/* Spinner */
.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--green-500);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.spinner-sm { width: 20px; height: 20px; border-width: 2px; }
.spinner-white { border-color: rgba(255,255,255,0.3); border-top-color: white; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-screen {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
}

/* Badge */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 12px; border-radius: 20px;
    font-size: 0.8rem; font-weight: 600;
}
.badge-green { background: var(--green-100); color: var(--green-700); }
.badge-amber { background: #FEF3C7; color: var(--amber-600); }
.badge-blue { background: var(--blue-50); color: var(--blue-500); }

/* Progress bar */
.progress-bar {
    width: 100%; height: 8px;
    background: var(--gray-200);
    border-radius: 4px; overflow: hidden;
}
.progress-fill {
    height: 100%; background: var(--green-500);
    border-radius: 4px; transition: width 0.3s ease;
}

/* Modal / Dialog */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 16px;
}
.modal {
    background: white; border-radius: var(--radius-lg);
    padding: 24px; max-width: 500px; width: 100%;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.5rem; color: var(--gray-400); padding: 4px;
    line-height: 1;
}
.modal-close:hover { color: var(--gray-700); }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* Logo icon */
.logo-icon {
    width: 80px; height: 80px;
    background: var(--green-500); border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem; color: white;
}
.logo-icon-sm { width: 56px; height: 56px; border-radius: 14px; font-size: 1.75rem; }

/* Snackbar */
.snackbar {
    position: fixed; bottom: 0; left: 0; right: 0;
    padding: 16px 20px;
    color: white; font-size: 0.9rem; font-weight: 600;
    z-index: 2000; opacity: 0; transition: opacity 0.3s;
    pointer-events: none; text-align: center;
}
.snackbar.show { opacity: 1; }
.snackbar-success { background: var(--green-600); }
.snackbar-error { background: var(--red-600); }
.snackbar-warning { background: var(--amber-500); }

/* Utility */
.hidden { display: none !important; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.p-md { padding: 16px; }

/* Responsive */
@media (max-width: 480px) {
    .container, .container-sm { padding: 16px 12px; }
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.25rem; }
}
