/* ============================================
   ROADFY - Estilos Principales
   ============================================ */

/* Variables CSS */
:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #ffffff;
    --bg-secondary: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 0.5rem;
    --transition: all 0.3s ease;
}

/* Reset y Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Headings */
h1, h2, h3 {
    color: var(--text-primary);
    letter-spacing: 0.2px;
}
h1 { font-weight: 700; line-height: 1.25; }
h2 { font-weight: 700; line-height: 1.3; }
h3 { font-weight: 600; line-height: 1.35; }

/* Header */
header {
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.25rem;
}

.logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    display: inline-block;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.logo-fallback {
    display: none;
    font-size: 1.5rem;
}

.logo i {
    font-size: 1.5rem;
}

/* Logo imagen SVG (revertido a icono + texto) */
.logo-text { display: inline; }

nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

nav a {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 0;
}

nav a:hover {
    color: var(--primary-color);
}

nav a.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn {
    padding: 0.625rem 1.125rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    text-align: center;
    line-height: 1.2;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.25);
}

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

.btn-secondary:hover {
    background: #eef2f7;
    border-color: #d8e0ea;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.25);
}

.btn-success {
    background-color: #25D366;
    color: white;
    border-color: #25D366;
}

.btn-success:hover {
    background-color: #20BA5A;
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.25);
}

/* Accesibilidad: foco visible */
.btn:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.35);
    outline-offset: 2px;
}

/* Main Content */
main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Cards */
.card {
    background: var(--bg-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.form-error {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Grid */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Tire Card */
.tire-card {
    background: var(--bg-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    text-decoration: none;
    display: block;
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.tire-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: #dbe3ee;
}

.tire-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-secondary);
}

.tire-card-body {
    padding: 1.5rem;
}

.tire-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.tire-card-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.tire-card-price {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* Hero Section */
.hero {
    position: relative;
    text-align: center;
    padding: 6rem 2rem;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: var(--radius);
    margin-bottom: 4rem;
    overflow: hidden;
    /* Fallback: imagen de Unsplash si no hay imagen local */
    background-image: url('https://images.unsplash.com/photo-1558618666-fcd25c85cd64?ixlib=rb-4.0.3&auto=format&fit=crop&w=2000&q=80');
}

/* Eliminar el pseudo-elemento ::before que creaba el overlay */
.hero::before {
    content: none; /* Eliminar el overlay */
}

.hero > * {
    position: relative;
    z-index: 1;
}

/* Business Card */
.business-card {
    background: var(--bg-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.business-card-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: calc(var(--radius) - 2px);
    margin-bottom: 1rem;
    background: var(--bg-secondary);
    display: block;
}

.business-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: #dbe3ee;
}

.business-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.business-card-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--warning-color);
}

.business-card-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

/* Filters */
.filters {
    background: var(--bg-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.filters-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.loading i {
    font-size: 2rem;
    /* Desactivar giro del icono de carga */
    animation: none;
}

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

/* Desactivar cualquier giro forzado de Font Awesome */
.fa-spin {
    animation: none !important;
}

/* Alert */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
}

/* Text utilities */
.muted { color: var(--text-secondary); }
.subtitle { color: var(--text-secondary); font-size: 0.95rem; }

/* Table */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-color);
    border-radius: var(--radius);
    overflow: hidden;
}

thead {
    background: var(--bg-secondary);
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-primary);
}

tr:hover {
    background: var(--bg-secondary);
}

/* Footer */
footer {
    background: var(--text-primary);
    color: white;
    padding: 2rem;
    margin-top: 3rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

/* Report Tabs */
.report-tab {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    margin-right: 0.5rem;
}

.report-tab:hover {
    color: var(--primary-color);
    background: var(--bg-secondary);
}

.report-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
    }

    nav {
        flex-wrap: wrap;
        gap: 1rem;
    }

    main {
        padding: 1rem;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .filters-grid {
        grid-template-columns: 1fr;
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden {
    display: none;
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

