/* ========================================
   POS Joyería — Main Stylesheet
   ======================================== */

:root {
    --primary:    #1a3c5e;
    --primary-lt: #2a5a8e;
    --accent:     #c9a84c;
    --success:    #28a745;
    --danger:     #dc3545;
    --warning:    #ffc107;
    --info:       #17a2b8;
    --bg:         #f0f4f8;
    --card-bg:    #ffffff;
    --text:       #2d3748;
    --text-muted: #718096;
    --border:     #e2e8f0;
    --sidebar-w:  0px;
    --radius:     8px;
    --shadow:     0 2px 8px rgba(0,0,0,0.08);
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

body.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, #0d2137 100%);
}

/* ---- Navbar ---- */
.navbar {
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    height: 56px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1rem;
}
.navbar-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
    margin-right: 1rem;
}
.navbar-menu {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    flex: 1;
    overflow-x: auto;
}
.navbar-menu a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    white-space: nowrap;
    transition: background 0.2s;
}
.navbar-menu a:hover { background: rgba(255,255,255,0.15); color: #fff; }
.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.8);
    white-space: nowrap;
}
.btn-logout {
    background: rgba(255,255,255,0.15);
    color: #fff !important;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.82rem;
    transition: background 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

/* ---- Main ---- */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ---- Login ---- */
.login-container { width: 100%; max-width: 420px; padding: 1rem; }
.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 2rem; color: var(--primary); }
.login-logo h1 { font-size: 1.6rem; margin-top: 0.5rem; }
.login-logo p { color: var(--text-muted); font-size: 0.9rem; }
.login-logo .fa-gem { color: var(--accent); }

/* ---- Cards ---- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}
.card-header {
    background: var(--primary);
    color: #fff;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.card-header h3 { font-size: 1rem; font-weight: 600; margin: 0; }
.card-body { padding: 1.25rem; }
.card-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.mt-3 { margin-top: 1rem; }

/* ---- Page Header ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.page-header h2 { font-size: 1.3rem; color: var(--primary); }
.date-badge {
    background: var(--primary);
    color: #fff;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.1s;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.98); }
.btn-primary   { background: var(--primary);  color: #fff; }
.btn-secondary { background: #64748b;          color: #fff; }
.btn-success   { background: var(--success);   color: #fff; }
.btn-danger    { background: var(--danger);    color: #fff; }
.btn-warning   { background: var(--warning);   color: #1a1a1a; }
.btn-info      { background: var(--info);      color: #fff; }
.btn-outline   { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-block     { width: 100%; justify-content: center; }
.btn-lg        { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-sm        { padding: 0.3rem 0.6rem; font-size: 0.78rem; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.35rem; font-size: 0.85rem; color: var(--text); }
.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text);
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,60,94,0.12);
}
.form-control-lg { font-size: 1rem; padding: 0.65rem 1rem; }
.form-control-sm { font-size: 0.8rem; padding: 0.3rem 0.5rem; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }
.col-md-2 { flex: 0 0 calc(16.66% - 1rem); }
.col-md-3 { flex: 0 0 calc(25% - 1rem); }
.col-md-4 { flex: 0 0 calc(33.33% - 1rem); }
.col-md-5 { flex: 0 0 calc(41.66% - 1rem); }
.col-md-6 { flex: 0 0 calc(50% - 1rem); }
.col-md-7 { flex: 0 0 calc(58.33% - 1rem); }
.input-group { display: flex; align-items: center; }
.input-prefix {
    background: var(--bg);
    border: 1px solid var(--border);
    border-right: none;
    padding: 0.5rem 0.65rem;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 0.875rem;
    color: var(--text-muted);
}
.input-group .form-control { border-radius: 0 var(--radius) var(--radius) 0; }

/* ---- Alerts ---- */
.alert {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger  { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ---- Tables ---- */
.table-responsive { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.875rem;
}
.data-table th {
    background: var(--primary);
    color: #fff;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}
.data-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tr:hover td { background: #f7fafd; }
.data-table tr:last-child td { border-bottom: none; }
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--text-muted); }

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-green  { background: #d4edda; color: #155724; }
.badge-red    { background: #f8d7da; color: #721c24; }
.badge-orange { background: #fff3cd; color: #856404; }
.badge-blue   { background: #d1ecf1; color: #0c5460; }
.badge-purple { background: #e2d9f3; color: #4a235a; }
.badge-gray   { background: #e2e8f0; color: #4a5568; }

/* ---- Filter Bar ---- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    margin-bottom: 1.25rem;
    background: #fff;
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.filter-bar .form-control { max-width: 200px; }
.filter-bar .form-group { margin-bottom: 0; }

/* ---- Dashboard Stats ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    border-left: 4px solid transparent;
}
.stat-card h3 { font-size: 1.6rem; font-weight: 700; }
.stat-card p  { font-size: 0.8rem; color: var(--text-muted); }
.stat-blue   { border-color: #3b82f6; }
.stat-blue   .fa { color: #3b82f6; }
.stat-green  { border-color: var(--success); }
.stat-green  .fa { color: var(--success); }
.stat-orange { border-color: #f59e0b; }
.stat-orange .fa { color: #f59e0b; }
.stat-red    { border-color: var(--danger); }
.stat-red    .fa { color: var(--danger); }

/* ---- Exchange Banner ---- */
.exchange-banner {
    background: linear-gradient(135deg, var(--primary), var(--primary-lt));
    color: #fff;
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}
.exchange-banner h4 { margin-bottom: 0.5rem; font-size: 0.9rem; opacity: 0.85; }
.exchange-grid { display: flex; gap: 2rem; flex-wrap: wrap; font-size: 0.95rem; }
.exchange-mini {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.85);
}

/* ---- Quick Actions ---- */
.quick-actions { margin-top: 1.5rem; }
.quick-actions h4 { margin-bottom: 0.75rem; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}
.action-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem 1rem;
    text-align: center;
    text-decoration: none;
    color: var(--primary);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.action-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.12); }
.action-card span { font-size: 0.85rem; font-weight: 500; }

/* ---- POS Layout ---- */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 1.25rem;
    align-items: start;
}
.search-results {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    max-height: 350px;
    overflow-y: auto;
    box-shadow: var(--shadow);
}
.search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.search-item:hover { background: #f0f7ff; }
.search-item:last-child { border-bottom: none; }
.search-item-info { display: flex; flex-direction: column; gap: 0.15rem; }
.search-item-info strong { font-size: 0.9rem; }
.search-item-info small { color: var(--text-muted); font-size: 0.78rem; }
.search-item-price { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; }
.tag-price { font-weight: 700; color: var(--primary); }

/* ---- Cart ---- */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    gap: 0.75rem;
    flex-wrap: wrap;
}
.cart-item-info { flex: 1; min-width: 120px; }
.cart-item-info strong { display: block; font-size: 0.9rem; }
.cart-item-info small { color: var(--text-muted); font-size: 0.78rem; display: block; }
.cart-item-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.cart-total { font-size: 1.2rem; text-align: right; color: var(--primary); margin-bottom: 0.75rem; }
.margin-display { display: flex; flex-direction: column; align-items: center; min-width: 70px; }
.margin-badge { font-weight: 700; font-size: 0.9rem; padding: 0.2rem 0.5rem; border-radius: 4px; }
.margin-positive { background: #d4edda; color: #155724; }
.margin-negative { background: #f8d7da; color: #721c24; }
.margin-display small { font-size: 0.7rem; color: var(--text-muted); }

/* ---- Detail Table ---- */
.detail-table { width: 100%; border-collapse: collapse; }
.detail-table th, .detail-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.detail-table th { width: 35%; font-weight: 600; color: var(--text-muted); background: var(--bg); }
.detail-table tr:last-child th, .detail-table tr:last-child td { border-bottom: none; }

/* ---- Receipt ---- */
.receipt-card {
    background: #fff;
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.receipt-header { text-align: center; margin-bottom: 1.5rem; }
.receipt-header h3 { color: var(--primary); font-size: 1.3rem; }
.receipt-exchange { background: var(--bg); padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.receipt-exchange h4 { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.35rem; }
.receipt-items { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.receipt-items th { background: var(--primary); color: #fff; padding: 0.5rem 0.75rem; font-size: 0.85rem; }
.receipt-items td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.receipt-items tfoot td { font-weight: 700; background: var(--bg); }
.receipt-actions { margin-top: 1.5rem; text-align: right; }
.credit-info { background: #fff3cd; padding: 1rem; border-radius: var(--radius); margin-top: 1rem; }

/* ---- Workshop ---- */
.workshop-note {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem;
    margin-bottom: 0.75rem;
    background: var(--bg);
}
.wn-header { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.5rem; }
.workshop-photo { max-width: 150px; border-radius: 4px; margin-top: 0.5rem; border: 1px solid var(--border); }

/* ---- Reports ---- */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}
.report-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}
.report-card h3 { font-size: 1rem; color: var(--primary); }
.report-card p  { font-size: 0.85rem; color: var(--text-muted); }
.report-icon { margin-bottom: 0.25rem; }
.text-blue   { color: #3b82f6; }
.text-green  { color: var(--success); }
.text-orange { color: #f59e0b; }
.text-red    { color: var(--danger); }
.text-purple { color: #7c3aed; }

/* ---- Product Detail Grid ---- */
.product-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ---- Footer ---- */
.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border);
}

/* ---- Misc ---- */
code {
    background: #f0f4f8;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.82rem;
    color: var(--primary);
    font-family: 'Courier New', monospace;
}
.mb-3 { margin-bottom: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }

/* ---- Print ---- */
@media print {
    .navbar, .no-print, .site-footer, .filter-bar, .page-header .btn { display: none !important; }
    .main-content { padding: 0; max-width: 100%; }
    .receipt-card { box-shadow: none; border: none; }
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .pos-layout { grid-template-columns: 1fr; }
    .card-grid-2 { grid-template-columns: 1fr; }
    .product-detail-grid { grid-template-columns: 1fr; }
    .form-row .col-md-2, .form-row .col-md-3, .form-row .col-md-4,
    .form-row .col-md-5, .form-row .col-md-6, .form-row .col-md-7 {
        flex: 1 1 100%;
    }
}
@media (max-width: 600px) {
    .navbar-menu { display: none; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
