/* ============================================================================
   BUYEE BOT DASHBOARD - THEME.CSS
   Classes semàntiques per unificar disseny entre index, settings i stats
   Compatible amb mode clar i fosc (Tailwind darkMode: 'class')
   ============================================================================ */

/* ── ESTRUCTURA BASE ────────────────────────────────────────────────────── */

.page-bg {
    background-color: rgb(249 250 251); /* gray-50 */
    color: rgb(17 24 39); /* gray-900 */
    min-height: 100vh;
}

.dark .page-bg {
    background-color: rgb(17 24 39); /* gray-900 */
    color: rgb(243 244 246); /* gray-100 */
}

/* ── CARDS / PANELLS ───────────────────────────────────────────────────── */

.card {
    background-color: white;
    border-radius: 0.75rem; /* rounded-xl */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* shadow-md */
    padding: 1.5rem; /* p-6 */
}

.dark .card {
    background-color: rgb(31 41 55); /* gray-800 */
}

.card-modal {
    background-color: white;
    border-radius: 0.75rem; /* rounded-xl */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); /* shadow-2xl */
    padding: 1.5rem; /* p-6 */
}

.dark .card-modal {
    background-color: rgb(31 41 55); /* gray-800 */
}

/* ── BOTONS ────────────────────────────────────────────────────────────── */

.btn-primary {
    background-color: rgb(37 99 235); /* blue-600 */
    color: white;
    font-weight: 500;
    padding: 0.5rem 1rem; /* px-4 py-2 */
    border-radius: 0.5rem; /* rounded-lg */
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.btn-primary:hover:not(:disabled) {
    background-color: rgb(29 78 216); /* blue-700 */
}

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

.btn-secondary {
    background-color: white;
    color: rgb(55 65 81); /* gray-700 */
    font-weight: 500;
    padding: 0.5rem 1rem; /* px-4 py-2 */
    border-radius: 0.5rem; /* rounded-lg */
    border: 1px solid rgb(209 213 219); /* border-gray-300 */
    cursor: pointer;
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.btn-secondary:hover:not(:disabled) {
    background-color: rgb(249 250 251); /* gray-50 */
}

.dark .btn-secondary {
    background-color: rgb(31 41 55); /* gray-800 */
    color: rgb(229 231 235); /* gray-200 */
    border-color: rgb(75 85 99); /* gray-600 */
}

.dark .btn-secondary:hover:not(:disabled) {
    background-color: rgb(55 65 81); /* gray-700 */
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-danger {
    background-color: rgb(220 38 38); /* red-600 */
    color: white;
    font-weight: 500;
    padding: 0.5rem 1rem; /* px-4 py-2 */
    border-radius: 0.5rem; /* rounded-lg */
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.btn-danger:hover:not(:disabled) {
    background-color: rgb(185 28 28); /* red-700 */
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-success {
    background-color: rgb(22 163 74); /* green-600 */
    color: white;
    font-weight: 500;
    padding: 0.5rem 1rem; /* px-4 py-2 */
    border-radius: 0.5rem; /* rounded-lg */
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.btn-success:hover:not(:disabled) {
    background-color: rgb(21 128 61); /* green-700 */
}

.btn-success:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-warning {
    background-color: rgb(234 88 12); /* orange-600 */
    color: white;
    font-weight: 500;
    padding: 0.5rem 1rem; /* px-4 py-2 */
    border-radius: 0.5rem; /* rounded-lg */
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.btn-warning:hover:not(:disabled) {
    background-color: rgb(194 65 12); /* orange-700 */
}

.btn-warning:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-ghost {
    background-color: transparent;
    color: rgb(107 114 128); /* gray-500 */
    font-weight: 500;
    padding: 0.5rem 1rem; /* px-4 py-2 */
    border-radius: 0.5rem; /* rounded-lg */
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

.btn-ghost:hover:not(:disabled) {
    background-color: rgb(243 244 246); /* gray-100 */
    color: rgb(55 65 81); /* gray-700 */
}

.dark .btn-ghost {
    color: rgb(156 163 175); /* gray-400 */
}

.dark .btn-ghost:hover:not(:disabled) {
    background-color: rgb(55 65 81); /* gray-700 */
    color: rgb(229 231 235); /* gray-200 */
}

.btn-ghost:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Botó especial per afegir a watchlist (fons groc, text SEMPRE fosc) */
.btn-warning-track {
    background-color: rgb(250 204 21); /* yellow-400 */
    color: rgb(17 24 39) !important; /* gray-900 SEMPRE (fins i tot en mode fosc) */
    font-weight: 500;
    padding: 0.5rem 1rem; /* px-4 py-2 */
    border-radius: 0.5rem; /* rounded-lg */
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.btn-warning-track:hover:not(:disabled) {
    background-color: rgb(234 179 8); /* yellow-500 */
}

.btn-warning-track:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dark .btn-warning-track {
    background-color: rgb(250 204 21); /* yellow-400 */
    color: rgb(17 24 39) !important; /* gray-900 SEMPRE en mode fosc */
}

.dark .btn-warning-track:hover:not(:disabled) {
    background-color: rgb(234 179 8); /* yellow-500 */
}

/* ── FORMULARIS ────────────────────────────────────────────────────────── */

.form-input,
.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem; /* px-3 py-2 */
    border: 1px solid rgb(209 213 219); /* border-gray-300 */
    border-radius: 0.5rem; /* rounded-lg */
    background-color: white;
    color: rgb(17 24 39); /* gray-900 */
    font-size: 0.875rem; /* text-sm */
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: rgb(59 130 246); /* blue-500 */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dark .form-input,
.dark .form-select {
    background-color: rgb(55 65 81); /* gray-700 */
    color: rgb(243 244 246); /* gray-100 */
    border-color: rgb(75 85 99); /* gray-600 */
}

.form-input:disabled,
.form-select:disabled {
    background-color: rgb(243 244 246); /* gray-100 */
    cursor: not-allowed;
    opacity: 0.6;
}

.dark .form-input:disabled,
.dark .form-select:disabled {
    background-color: rgb(75 85 99); /* gray-600 */
}

.form-label {
    display: block;
    font-size: 0.875rem; /* text-sm */
    font-weight: 500;
    color: rgb(55 65 81); /* gray-700 */
    margin-bottom: 0.25rem; /* mb-1 */
}

.dark .form-label {
    color: rgb(229 231 235); /* gray-200 */
}

.form-help {
    font-size: 0.75rem; /* text-xs */
    color: rgb(107 114 128); /* gray-500 */
    margin-top: 0.25rem; /* mt-1 */
}

.dark .form-help {
    color: rgb(156 163 175); /* gray-400 */
}

/* ── ALERTES ───────────────────────────────────────────────────────────── */

.alert-error {
    background-color: rgb(254 242 242); /* red-50 */
    color: rgb(185 28 28); /* red-700 */
    padding: 0.75rem 1rem; /* px-4 py-3 */
    border-radius: 0.5rem; /* rounded-lg */
    font-size: 0.875rem; /* text-sm */
}

.dark .alert-error {
    background-color: rgba(127, 29, 29, 0.3); /* red-900/30 */
    color: rgb(252 165 165); /* red-300 */
}

.alert-warning {
    background-color: rgb(254 252 232); /* yellow-50 */
    color: rgb(161 98 7); /* yellow-700 */
    padding: 1rem; /* p-4 */
    border-left: 4px solid rgb(250 204 21); /* yellow-400 */
    border-radius: 0.5rem; /* rounded-lg */
}

.dark .alert-warning {
    background-color: rgba(113, 63, 18, 0.3); /* yellow-900/30 */
    color: rgb(253 224 71); /* yellow-300 */
    border-left-color: rgb(202 138 4); /* yellow-600 */
}

.alert-success {
    background-color: rgb(240 253 244); /* green-50 */
    color: rgb(21 128 61); /* green-700 */
    padding: 0.75rem 1rem; /* px-4 py-3 */
    border-radius: 0.5rem; /* rounded-lg */
    font-size: 0.875rem; /* text-sm */
}

.dark .alert-success {
    background-color: rgba(20, 83, 45, 0.3); /* green-900/30 */
    color: rgb(134 239 172); /* green-300 */
}

.alert-info {
    background-color: rgb(239 246 255); /* blue-50 */
    color: rgb(29 78 216); /* blue-700 */
    padding: 0.75rem 1rem; /* px-4 py-3 */
    border-radius: 0.5rem; /* rounded-lg */
    font-size: 0.875rem; /* text-sm */
}

.dark .alert-info {
    background-color: rgba(30, 58, 138, 0.3); /* blue-900/30 */
    color: rgb(147 197 253); /* blue-300 */
}

/* ── BADGES ────────────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem; /* px-2 py-0.5 */
    border-radius: 9999px; /* rounded-full */
    font-size: 0.75rem; /* text-xs */
    font-weight: 500;
}

.badge-blue {
    background-color: rgb(219 234 254); /* blue-100 */
    color: rgb(30 64 175); /* blue-800 */
}

.dark .badge-blue {
    background-color: rgb(30 58 138); /* blue-900 */
    color: rgb(191 219 254); /* blue-200 */
}

.badge-green {
    background-color: rgb(220 252 231); /* green-100 */
    color: rgb(22 101 52); /* green-800 */
}

.dark .badge-green {
    background-color: rgb(20 83 45); /* green-900 */
    color: rgb(187 247 208); /* green-200 */
}

.badge-red {
    background-color: rgb(254 226 226); /* red-100 */
    color: rgb(153 27 27); /* red-800 */
}

.dark .badge-red {
    background-color: rgb(127 29 29); /* red-900 */
    color: rgb(254 202 202); /* red-200 */
}

.badge-yellow {
    background-color: rgb(254 249 195); /* yellow-100 */
    color: rgb(133 77 14); /* yellow-800 */
}

.dark .badge-yellow {
    background-color: rgb(113 63 18); /* yellow-900 */
    color: rgb(254 240 138); /* yellow-200 */
}

.badge-gray {
    background-color: rgb(243 244 246); /* gray-100 */
    color: rgb(31 41 55); /* gray-800 */
}

.dark .badge-gray {
    background-color: rgb(55 65 81); /* gray-700 */
    color: rgb(229 231 235); /* gray-200 */
}

/* ── NAVEGACIÓ PESTANYES ───────────────────────────────────────────────── */

.tab-nav {
    display: flex;
    gap: 0.5rem; /* gap-2 */
    border-bottom: 1px solid rgb(229 231 235); /* border-gray-200 */
    padding-bottom: 0; /* eliminar padding per posar-lo als items */
}

.dark .tab-nav {
    border-bottom-color: rgb(75 85 99); /* gray-600 */
}

.tab-item {
    padding: 0.75rem 1.5rem; /* px-6 py-3 */
    font-weight: 500;
    color: rgb(107 114 128); /* gray-500 */
    background-color: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s ease-in-out, border-color 0.15s ease-in-out;
    text-decoration: none;
}

.tab-item:hover {
    color: rgb(55 65 81); /* gray-700 */
    border-bottom-color: rgb(209 213 219); /* gray-300 */
}

.dark .tab-item {
    color: rgb(156 163 175); /* gray-400 */
}

.dark .tab-item:hover {
    color: rgb(229 231 235); /* gray-200 */
    border-bottom-color: rgb(107 114 128); /* gray-500 */
}

.tab-item-active {
    color: rgb(37 99 235); /* blue-600 */
    border-bottom-color: rgb(37 99 235); /* blue-600 */
    font-weight: 600;
}

.dark .tab-item-active {
    color: rgb(96 165 250); /* blue-400 */
    border-bottom-color: rgb(96 165 250); /* blue-400 */
}

/* ── TIPOGRAFIA ────────────────────────────────────────────────────────── */

.page-title {
    font-size: 1.875rem; /* text-3xl */
    font-weight: 700;
    color: rgb(17 24 39); /* gray-900 */
    margin-bottom: 1.5rem; /* mb-6 */
}

.dark .page-title {
    color: rgb(243 244 246); /* gray-100 */
}

.section-title {
    font-size: 1.25rem; /* text-xl */
    font-weight: 600;
    color: rgb(31 41 55); /* gray-800 */
    margin-bottom: 1rem; /* mb-4 */
}

.dark .section-title {
    color: rgb(229 231 235); /* gray-200 */
}

.text-muted {
    color: rgb(107 114 128); /* gray-500 */
    font-size: 0.875rem; /* text-sm */
}

.dark .text-muted {
    color: rgb(156 163 175); /* gray-400 */
}
