/* ====================================
   VARIABLES Y ESTILOS GLOBALES
   ==================================== */

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --success-color: #28a745;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --light-color: #f3f4f6;
    --dark-color: #1f2937;
    --border-color: #e5e7eb;
    --text-color: #374151;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

html, body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #ffffff;
}

/* ====================================
   NAVBAR / HEADER
   ==================================== */

.navbar {
    height: 60px;
    z-index: 1000;
}

.navbar-brand {
    font-size: 1rem;
    color: var(--success-color) !important;
    flex: 1;
    min-width: 0;
}

.navbar-brand p {
    margin: 0;
    line-height: 1.2;
}

.logout-button {
    white-space: nowrap;
}

header {
    height: 70px;
    padding: 0.5rem 0;
    position: relative;
}

@media (min-width: 768px) {
    header {
        height: 60px;
        padding: 1rem 0;
    }
}

/* ====================================
   CONTENEDOR PRINCIPAL
   ==================================== */

main.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem 5rem;
    min-height: calc(100vh - 200px);
}

/* ====================================
   SECCIÓN DE BIENVENIDA
   ==================================== */

.welcome-section {
    margin-bottom: 3rem;
}

.welcome-section h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.welcome-section > p {
    font-size: 1.1rem;
    color: #6b7280;
    margin-bottom: 2rem;
}

/* ====================================
   GRID DE DASHBOARD
   ==================================== */

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

.card {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.card p {
    color: #6b7280;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

/* ====================================
   BOTONES
   ==================================== */

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

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

.btn-primary:hover {
    background-color: var(--secondary-color);
    box-shadow: var(--shadow);
}

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

.btn-secondary:hover {
    background-color: #e5e7eb;
}

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

.btn-success:hover {
    background-color: #059669;
}

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

.btn-danger:hover {
    background-color: #dc2626;
}

/* ====================================
   FOOTER
   ==================================== */

footer {
    background-color: #1f2937;
    color: white;
    padding: 10px 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    font-size: 1rem;
}

footer a {
    color: white;
    text-decoration: none;
    transition: opacity 0.2s;
}

footer a:hover {
    opacity: 0.8;
}

footer img {
    filter: brightness(1.1);
}

footer .container {
    min-height: auto;
    display: flex;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

/* ====================================
   TABLAS
   ==================================== */

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

th {
    background-color: var(--light-color);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

tr:hover {
    background-color: var(--light-color);
}

/* ====================================
   FORMULARIOS
   ==================================== */

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

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* ====================================
   ALERTAS Y MENSAJES
   ==================================== */

.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-success {
    background-color: #ecfdf5;
    border-color: var(--success-color);
    color: #047857;
}

.alert-danger {
    background-color: #fef2f2;
    border-color: var(--danger-color);
    color: #991b1b;
}

.alert-warning {
    background-color: #fffbeb;
    border-color: var(--warning-color);
    color: #92400e;
}

.alert-info {
    background-color: #eff6ff;
    border-color: var(--info-color);
    color: #0c4a6e;
}

/* ====================================
   RESPONSIVE DESIGN
   ==================================== */

@media (max-width: 768px) {
    body {
        padding-top: 60px;
        padding-bottom: 55px;
    }

    .navbar {
        height: 50px;
        padding: 5px 10px;
    }

    .navbar-brand {
        font-size: 0.85rem;
    }

    .logout-button {
        padding: 6px 12px !important;
        font-size: 0.85rem;
    }

    .logout-button span {
        display: none !important;
    }

    .logout-button i {
        margin: 0 !important;
    }

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

    .welcome-section h2 {
        font-size: 1.5rem;
    }

    main.container {
        padding: 0 1rem 3rem;
    }

    footer {
        padding: 8px 0;
    }

    footer .container {
        gap: 12px !important;
        font-size: 0.75rem;
        padding: 0 10px;
    }

    footer img[alt="Isologo Cormons"] {
        width: 30px !important;
        height: 30px !important;
        margin-right: 5px !important;
    }

    footer img[alt="Logo WhatsApp"] {
        width: 18px !important;
        height: 18px !important;
        margin-right: 4px !important;
    }
}

@media (max-width: 576px) {
    body {
        padding-bottom: 50px;
    }

    .navbar-brand {
        font-size: 0.75rem;
    }

    footer {
        padding: 6px 0;
    }

    footer .container {
        gap: 8px !important;
        font-size: 0.7rem;
    }

    footer img[alt="Isologo Cormons"] {
        width: 24px !important;
        height: 24px !important;
    }

    footer img[alt="Logo WhatsApp"] {
        width: 16px !important;
        height: 16px !important;
    }
}

/* Pantallas muy pequeñas (menos de 324px) */
@media (max-width: 324px) {
    .navbar {
        height: 45px;
    }

    .navbar-brand {
        font-size: 0.65rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .navbar-brand p {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .logout-button {
        padding: 4px 8px !important;
        font-size: 0.75rem;
        min-width: 32px;
    }

    .logout-button i {
        font-size: 0.9rem;
    }
}

/* Mejoras para touch devices */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
    }
}
