/* Modern Dashboard & Application Stylesheet
   FirePhoenixDev Quotation & Invoice Management System */

:root {
    --primary-blue: #0f3b7d;
    --primary-hover: #0b2b5c;
    --accent-blue: #1d72b8;
    --secondary-blue: #e8f0fe;
    --dark-slate: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --body-bg: #f8fafc;
    --success-green: #10b981;
    --warning-orange: #f59e0b;
    --danger-red: #ef4444;
}

html {
    overflow-x: hidden;
    width: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--body-bg);
    color: var(--dark-slate);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

main {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.container-fluid {
    width: 100%;
    max-width: 100%;
}

/* Navbar */
.navbar-brand-custom {
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #ffffff !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-custom {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #17428b 100%);
    box-shadow: 0 4px 12px rgba(15, 59, 125, 0.15);
}

.nav-link-custom {
    color: rgba(255, 255, 255, 0.85) !important;
    font-weight: 500;
    padding: 8px 14px !important;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.nav-link-custom:hover, .nav-link-custom.active {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.12);
}

/* Metric Cards */
.metric-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 10px 15px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 16px 20px -4px rgba(0, 0, 0, 0.06);
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.metric-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--dark-slate);
    margin-top: 4px;
    margin-bottom: 0;
}

.metric-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Card General */
.app-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    max-width: 100%;
    width: 100%;
}

.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.app-card-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.app-card-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    color: var(--dark-slate);
}

.app-card-body {
    padding: 24px;
}

/* Tables */
.table-custom {
    margin-bottom: 0;
}

.table-custom thead th {
    background-color: #f1f5f9;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 12px 16px;
    border-top: none;
    border-bottom: 1px solid var(--border-color);
}

.table-custom tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.table-custom tbody tr:hover {
    background-color: #f8fafc;
}

/* Badges */
.badge-status {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: capitalize;
    display: inline-block;
}

.badge-status-draft { background-color: #e2e8f0; color: #475569; }
.badge-status-sent { background-color: #e0f2fe; color: #0369a1; }
.badge-status-accepted { background-color: #dcfce7; color: #15803d; }
.badge-status-rejected { background-color: #fee2e2; color: #b91c1c; }
.badge-status-converted { background-color: #f3e8ff; color: #7e22ce; }
.badge-status-not_paid { background-color: #fef3c7; color: #b45309; }
.badge-status-paid { background-color: #dcfce7; color: #15803d; }
.badge-status-cancelled { background-color: #fee2e2; color: #b91c1c; }
.badge-status-overdue { background-color: #ffe4e6; color: #be123c; }

/* Buttons */
.btn-primary-custom {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
    color: #ffffff;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-primary-custom:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 59, 125, 0.25);
}

.btn-whatsapp {
    background-color: #25d366;
    border-color: #25d366;
    color: #ffffff;
    font-weight: 600;
}
.btn-whatsapp:hover {
    background-color: #1ebc57;
    border-color: #1ebc57;
    color: #ffffff;
}

/* Forms */
.form-label-custom {
    font-weight: 600;
    font-size: 13px;
    color: #334155;
    margin-bottom: 6px;
}

.form-control-custom, .form-select-custom {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 9px 13px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control-custom:focus, .form-select-custom:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(29, 114, 184, 0.15);
}

/* Document Creation Table */
.items-table th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 13px;
}

.items-table td {
    padding: 8px;
    vertical-align: top;
}

.calc-summary-card {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
}

.calc-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}

.calc-summary-row.total-row {
    border-top: 2px solid #cbd5e1;
    margin-top: 8px;
    padding-top: 12px;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-blue);
}

/* Autocomplete dropdown */
.autocomplete-suggestions {
    position: absolute;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    overflow: auto;
    z-index: 9999;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    max-height: 250px;
    width: 100%;
}

.autocomplete-suggestion {
    padding: 10px 14px;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
}

.autocomplete-suggestion:hover, .autocomplete-suggestion.selected {
    background: #f1f5f9;
    color: var(--primary-blue);
}

/* Print/A4 Container */
@media print {
    body {
        background: #ffffff !important;
    }
    .no-print {
        display: none !important;
    }
}

/* Responsive Mobile Offcanvas Sidebar */
@media (max-width: 991.98px) {
    .navbar-offcanvas {
        width: 300px !important;
        max-width: 85vw !important;
        background: linear-gradient(180deg, #0f3b7d 0%, #0a254e 100%) !important;
        color: #ffffff;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
    }

    .navbar-offcanvas .offcanvas-header {
        background: #0b2b5c;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
        padding: 16px 20px;
    }

    .navbar-offcanvas .offcanvas-body {
        padding: 20px;
        display: flex;
        flex-direction: column;
        height: 100%;
        overflow-y: auto;
    }

    .navbar-offcanvas .nav-link-custom {
        color: rgba(255, 255, 255, 0.9) !important;
        padding: 10px 14px !important;
        font-size: 15px;
        font-weight: 500;
        display: flex;
        align-items: center;
        border-radius: 8px;
        margin-bottom: 4px;
        transition: all 0.2s ease;
    }

    .navbar-offcanvas .nav-link-custom:hover,
    .navbar-offcanvas .nav-link-custom.active {
        background-color: rgba(255, 255, 255, 0.15) !important;
        color: #ffffff !important;
    }

    .navbar-offcanvas .dropdown-menu {
        background: #0b2b5c !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        border-radius: 8px !important;
        padding: 8px !important;
        margin-top: 4px !important;
        box-shadow: 0 8px 20px rgba(0,0,0,0.3) !important;
    }

    .navbar-offcanvas .dropdown-item {
        color: rgba(255, 255, 255, 0.85) !important;
        font-size: 14px;
        padding: 8px 12px;
        border-radius: 6px;
    }

    .navbar-offcanvas .dropdown-item:hover {
        background: rgba(255, 255, 255, 0.15) !important;
        color: #ffffff !important;
    }

    .navbar-offcanvas .dropdown-divider {
        border-top-color: rgba(255, 255, 255, 0.15) !important;
    }
}

@media (max-width: 767.98px) {
    .container-fluid.px-4,
    .container-fluid.px-3 {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .metric-card {
        padding: 16px;
    }

    .metric-value {
        font-size: 22px;
    }

    .app-card-header {
        padding: 12px 16px;
    }

    .app-card-body {
        padding: 16px;
    }

    .table-custom thead th {
        padding: 10px 12px;
        font-size: 11px;
    }

    .table-custom tbody td {
        padding: 10px 12px;
        font-size: 13px;
    }
}
