/**
 * ERP ARROBA™ — CSS Unificado
 * Diseño corporativo consistente con arroba.massolagroup.com
 */

:root {
    --pr: #3498db;
    --dark: #2c3e50;
    --dark2: #34495e;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #17a2b8;
    --bg: #f0f4f8;
    --white: #ffffff;
    --border: #e2e8f0;
    --text: #2c3e50;
    --muted: #7f8c8d;
    --shadow: 0 4px 16px rgba(44,62,80,.10);
    --shadow-sm: 0 2px 8px rgba(44,62,80,.07);
    --radius: 12px;
    --radius-sm: 8px;
}

* { margin:0; padding:0; box-sizing:border-box; }
html { font-size:16px; scroll-behavior:smooth; }

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

/* ── NAVBAR ─────────────────────────────────────────────── */
.navbar {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark2) 100%);
    box-shadow: 0 2px 12px rgba(44,62,80,.3);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.nav-row1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 52px;
    padding: 0 20px;
}

.nav-row2 {
    border-top: 1px solid rgba(255,255,255,.1);
    padding: 3px 16px 4px;
    overflow-x: auto;
    scrollbar-width: none;
}
.nav-row2::-webkit-scrollbar { display: none; }

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    text-decoration: none;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .5px;
}

.nav-brand img { height: 40px; filter: brightness(0) invert(1); }

.nav-brand span { color: var(--pr); }

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1px;
    align-items: center;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.nav-menu > li { position: relative; }

.nav-menu > li > a {
    color: rgba(255,255,255,.88);
    text-decoration: none;
    padding: 6px 11px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all .2s;
    white-space: nowrap;
}

.nav-menu > li > a:hover,
.nav-menu > li > a.active {
    background: rgba(255,255,255,.15);
    color: white;
}

/* Dropdown */
.nav-menu .dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    min-width: 200px;
    padding: 6px;
    z-index: 2000;
    border: 1px solid var(--border);
}

.nav-menu li:hover .dropdown-menu { display: block; }

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 13.5px;
    transition: all .2s;
}

.dropdown-menu a:hover { background: var(--bg); color: var(--pr); }

.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    background: rgba(255,255,255,.12);
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 13px;
    border: 1px solid rgba(255,255,255,.2);
    text-decoration: none;
    transition: all .2s;
}

.nav-user:hover { background: rgba(255,255,255,.2); }

.user-avatar {
    width: 30px;
    height: 30px;
    background: var(--pr);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

/* ── MAIN CONTENT ──────────────────────────────────────── */
.main-content {
    max-width: 1500px;
    margin: 0 auto;
    padding: 28px 24px;
    min-height: calc(100vh - 130px);
}

/* ── PAGE HEADER ───────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 2px solid var(--pr);
}

.page-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header h1 i { color: var(--pr); }

.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── CARDS ─────────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafbfc;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i { color: var(--pr); }
.card-body { padding: 24px; }

/* ── STAT CARDS ────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: transform .2s, box-shadow .2s;
    text-decoration: none;
    color: inherit;
}

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

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.blue { background: #dbeafe; color: #1d4ed8; }
.stat-icon.green { background: #d1fae5; color: #065f46; }
.stat-icon.orange { background: #fef3c7; color: #92400e; }
.stat-icon.red { background: #fee2e2; color: #991b1b; }
.stat-icon.purple { background: #ede9fe; color: #5b21b6; }
.stat-icon.teal { background: #ccfbf1; color: #134e4a; }

.stat-info .stat-num {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
}

.stat-info .stat-label {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

/* ── BUTTONS ───────────────────────────────────────────── */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all .2s;
    white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }

.btn-primary { background: linear-gradient(135deg, var(--pr), var(--dark)); color: white; }
.btn-primary:hover { box-shadow: 0 4px 14px rgba(52,152,219,.4); }

.btn-success { background: linear-gradient(135deg, var(--success), #1e8449); color: white; }
.btn-success:hover { box-shadow: 0 4px 14px rgba(39,174,96,.4); }

.btn-warning { background: linear-gradient(135deg, var(--warning), #e67e22); color: white; }
.btn-danger { background: linear-gradient(135deg, var(--danger), #c0392b); color: white; }
.btn-info { background: linear-gradient(135deg, var(--info), #138496); color: white; }

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--pr); color: var(--pr); }

.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-lg { padding: 13px 28px; font-size: 16px; }

/* ── TABLES ────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 14px;
}

thead tr {
    background: linear-gradient(135deg, var(--dark), var(--dark2));
    color: white;
}

thead th {
    padding: 13px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* ── BADGES ────────────────────────────────────────────── */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1d4ed8; }
.badge-secondary { background: #e2e8f0; color: #475569; }

/* ── FORMS ─────────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.col-span-2 { grid-column: span 2; }
.col-span-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    background: white;
    transition: border-color .2s, box-shadow .2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--pr);
    box-shadow: 0 0 0 3px rgba(52,152,219,.12);
}

.form-section {
    background: #fafbfc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 20px;
}

.form-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--pr);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section-title i { color: var(--pr); }

/* ── ALERTS ────────────────────────────────────────────── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid var(--success); }
.alert-error { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--warning); }
.alert-info { background: #dbeafe; color: #1d4ed8; border-left: 4px solid var(--pr); }

/* ── SEARCH BAR ────────────────────────────────────────── */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: var(--pr);
}

/* ── FOOTER ────────────────────────────────────────────── */
footer {
    background: linear-gradient(135deg, var(--dark), var(--dark2));
    color: rgba(255,255,255,.8);
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    font-size: 13px;
    border-top: 3px solid var(--pr);
}

footer strong { color: white; }

/* ── ICON BUTTONS ──────────────────────────────────────── */
.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    text-decoration: none;
    transition: all .2s;
}

.icon-btn:hover { transform: translateY(-1px); }
.icon-btn-primary { background: #dbeafe; color: #1d4ed8; }
.icon-btn-success { background: #d1fae5; color: #065f46; }
.icon-btn-danger { background: #fee2e2; color: #991b1b; }
.icon-btn-warning { background: #fef3c7; color: #92400e; }

/* ── EMPTY STATE ───────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

.empty-state i { font-size: 48px; margin-bottom: 16px; display: block; opacity: .4; }
.empty-state h3 { font-size: 18px; color: var(--dark); margin-bottom: 8px; }

/* ── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 968px) {
    .nav-container { flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 10px; }
    .nav-menu { flex-wrap: wrap; gap: 4px; }
    .nav-menu > li > a { font-size: 13px; padding: 8px 12px; }
    .dropdown-menu { position: static; box-shadow: none; border: none; background: rgba(255,255,255,.1); }
    .dropdown-menu a { color: rgba(255,255,255,.8); }
    .dropdown-menu a:hover { color: white; background: rgba(255,255,255,.1); }
    .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
    .col-span-2 { grid-column: span 1; }
}

@media (max-width: 600px) {
    .main-content { padding: 16px; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 14px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    thead th { font-size: 12px; padding: 10px 10px; }
    tbody td { padding: 10px; font-size: 13px; }
}

/* ── PRINT STYLES ──────────────────────────────────────── */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    @page {
        size: letter;
        margin: 18mm 20mm;
    }

    body {
        background: white !important;
        font-family: Arial, sans-serif !important;
        font-size: 11pt !important;
        color: #000 !important;
    }

    .navbar,
    .no-print,
    footer,
    .header-actions,
    .search-bar,
    .btn,
    button:not(.print-show) {
        display: none !important;
    }

    .main-content {
        padding: 0 !important;
        max-width: 100% !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        page-break-inside: avoid;
    }

    .card-header {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact !important;
    }

    .form-section {
        background: white !important;
        border: 1px solid #bbb !important;
        page-break-inside: avoid;
    }

    .form-section-title {
        border-bottom-color: #333 !important;
        color: #000 !important;
    }

    table {
        font-size: 10pt !important;
        page-break-inside: auto;
    }

    tr { page-break-inside: avoid; }

    thead tr {
        background: #2c3e50 !important;
        color: white !important;
        -webkit-print-color-adjust: exact !important;
    }

    thead th {
        padding: 7px 10px !important;
        font-size: 10pt !important;
    }

    tbody td {
        padding: 7px 10px !important;
        border-bottom: 1px solid #ddd !important;
    }

    .page-header {
        border-bottom: 2px solid #2c3e50 !important;
        margin-bottom: 16px !important;
        padding-bottom: 12px !important;
    }

    .page-header h1 { font-size: 16pt !important; }

    .print-header {
        display: flex !important;
        align-items: center !important;
        gap: 20px !important;
        margin-bottom: 20px !important;
        padding-bottom: 14px !important;
        border-bottom: 2px solid #2c3e50 !important;
    }

    .print-logo { height: 50px !important; display: block !important; }

    .print-title {
        font-size: 18pt !important;
        font-weight: bold !important;
        color: #2c3e50 !important;
    }

    .badge {
        border: 1px solid #999 !important;
        -webkit-print-color-adjust: exact !important;
    }

    .page-break { page-break-after: always; }
    .no-break { page-break-inside: avoid; }

    .firma-section {
        display: flex !important;
        justify-content: space-around !important;
        margin-top: 50px !important;
    }

    .firma-box {
        text-align: center !important;
        width: 40% !important;
    }

    .firma-line {
        border-top: 1px solid #333 !important;
        margin-top: 55px !important;
        padding-top: 6px !important;
        font-size: 10pt !important;
    }
}
