/* =============================================================
   Framework - Global Styles (Blue / Light-Blue Theme)
   ============================================================= */

/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}
a { color: #2f7bd6; text-decoration: none; transition: color 0.2s; }
a:hover { color: #1f5a94; }

/* ===== Typography ===== */
h1 { color: #16324f; margin-bottom: 20px; font-size: 1.6rem; font-weight: 600; }
h2 { color: #16324f; margin-bottom: 16px; font-size: 1.3rem; font-weight: 600; }
h3 { color: #27496d; margin-bottom: 12px; font-size: 1.1rem; font-weight: 500; }
/* h4/h5 were previously unstyled, so any page using them (order detail's
   card headings, etc.) fell back to the browser's default bold/black
   heading style instead of matching h1-h3 — that's what made those pages
   read as a different font from the rest of the account section. */
h4 { color: #16324f; margin-bottom: 12px; font-size: 1rem; font-weight: 600; }
h5 { color: #27496d; margin-bottom: 10px; font-size: 0.92rem; font-weight: 600; }

/* ===== Reusable Layout ===== */
.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }
.content-wrapper { padding: 24px; }
.card {
    background: #fff;
    border: 1px solid #d7e3f0;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e8ebe5;
}

/* ===== Reusable Spacing ===== */
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.p-16 { padding: 16px; }
.p-24 { padding: 24px; }

/* ===== Reusable Flex ===== */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.flex-gap-8 { gap: 8px; }
.flex-gap-12 { gap: 12px; }

/* ===== Reusable Text ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #888; }
.text-success { color: #2f7bd6; }
.text-danger { color: #c0392b; }
.text-small { font-size: 0.85rem; }
.text-bold { font-weight: 600; }

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 8px 18px;
    border: none;
    border-radius: 5px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s, box-shadow 0.2s;
    line-height: 1.5;
}
.btn:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.12); }
.btn-primary { background: #2f7bd6; color: #fff; }
.btn-primary:hover { background: #2563a8; color: #fff; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-secondary:hover { background: #5a6268; color: #fff; }
.btn-danger { background: #c0392b; color: #fff; }
.btn-danger:hover { background: #a5301f; color: #fff; }
.btn-warning { background: #e67e22; color: #fff; }
.btn-warning:hover { background: #cf6d17; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-outline {
    background: transparent;
    color: #2f7bd6;
}
.btn-outline:hover { background: #2f7bd6; color: #fff; }
.btn-outline.disabled,
.btn-outline:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: transparent;
    color: #2f7bd6;
}
.btn-outline.disabled:hover,
.btn-outline:disabled:hover { background: transparent; color: #2f7bd6; }

/* ===== Pagination (numbered pages + Previous/Next, e.g. account order history) ===== */
.pagination-container {
    padding: 14px 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    background: #fff;
    border-radius: 0 0 8px 8px;
}
.page-numbers {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.page-btn {
    padding: 0 12px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #c8cec5;
    background: #fff;
    color: #2f7bd6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s;
    box-sizing: border-box;
    text-decoration: none;
}
.page-btn:hover:not(.active) { background: #eef5fc; color: #1f5a94; }
.page-btn.active { background: #2f7bd6; color: #fff; border-color: #2f7bd6; }

@media (max-width: 768px) {
    .pagination-container {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    .page-numbers { justify-content: center; }
}


/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    border-radius: 5px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { 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; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #16324f;
    font-size: 0.9rem;
}
.form-control {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid #c8cec5;
    border-radius: 5px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}
.form-control:focus {
    outline: none;
    border-color: #2f7bd6;
    box-shadow: 0 0 0 3px rgba(47, 123, 214, 0.15);
}
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
}
.table th, .table td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid #e8ebe5;
    font-size: 0.9rem;
}
.table th {
    background: #27496d;
    color: #fff;
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.table tbody tr:hover { background: #eef5fc; }
.table .actions { white-space: nowrap; }
.table .actions a, .table .actions button { margin-right: 6px; }

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 500;
}
.badge-active { background: #d4edda; color: #155724; }
.badge-inactive { background: #e2e3e5; color: #6c757d; }
.badge-role { background: #d1ecf1; color: #0c5460; }

/* ===== Code ===== */
code { background: #eef; padding: 2px 6px; border-radius: 3px; font-size: 0.9rem; }

/* ===== Tabs ===== */
.tabs {
    display: flex;
    border-bottom: 2px solid #e8ebe5;
    margin-bottom: 20px;
}
.tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s;
}
.tab-btn:hover {
    color: #2f7bd6;
}
.tab-btn.active {
    color: #2f7bd6;
    border-bottom-color: #2f7bd6;
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* =============================================================
   Responsive Breakpoints
   ============================================================= */

/* --- Tablet (<=992px) --- */
@media (max-width: 992px) {
    .container { max-width: 100%; padding: 0 16px; }
    .card { padding: 20px; }
    h1 { font-size: 1.35rem; }
    h2 { font-size: 1.15rem; }
}

/* --- Mobile (<=768px) --- */
@media (max-width: 768px) {
    .card { padding: 16px; margin-bottom: 14px; }
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .card-header .btn { align-self: flex-start; }
    h1 { font-size: 1.2rem; margin-bottom: 14px; }
    h2 { font-size: 1.05rem; margin-bottom: 12px; }
    .content-wrapper { padding: 16px; }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0;
        flex-wrap: nowrap;
    }
    .tab-btn {
        padding: 10px 14px;
        font-size: 0.85rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .table th, .table td {
        padding: 8px 10px;
        font-size: 0.82rem;
    }
    .table th { font-size: 0.78rem; }

    .btn { padding: 7px 14px; font-size: 0.82rem; }
    .btn-sm { padding: 4px 10px; font-size: 0.75rem; }

    .form-group label { font-size: 0.85rem; }
    .form-control { padding: 8px 12px; font-size: 0.85rem; }

    .flex-gap-12 { gap: 8px; }
    .flex-gap-8 { gap: 6px; }
}

/* --- Small Mobile (<=480px) --- */
@media (max-width: 480px) {
    body { font-size: 13px; }
    .card { padding: 12px; border-radius: 6px; }
    .card-header { padding-bottom: 10px; margin-bottom: 14px; }
    h1 { font-size: 1.1rem; }
    .btn { padding: 6px 12px; font-size: 0.8rem; }
    .btn-sm { padding: 4px 8px; font-size: 0.72rem; }
    .table th, .table td { padding: 6px 8px; }
    .badge { padding: 2px 8px; font-size: 0.72rem; }
    .alert { padding: 10px 12px; font-size: 0.82rem; }
}
