/* ============================================
   Lightweight CSS Framework - Bootstrap Replacement
   ============================================ */

/* --- Box Sizing & Resets --- */
*, *::before, *::after {
    box-sizing: border-box;
}

a, button, input, select, textarea {
    font-family: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

/* --- Container --- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* --- Grid System (Flexbox) --- */
.row {
    display: flex;
    flex-wrap: wrap;
}

/* Column base - float fallback ensures columns work outside .row too */
[class*="col-"] {
    position: relative;
    min-height: 1px;
    float: left;
}

/* Inside a .row, flexbox handles layout so disable float */
.row > [class*="col-"] {
    float: none;
}

/* xs columns (always active) */
.col-xs-1  { width: 8.3333%; }
.col-xs-2  { width: 16.6667%; }
.col-xs-3  { width: 25%; }
.col-xs-4  { width: 33.3333%; }
.col-xs-5  { width: 41.6667%; }
.col-xs-6  { width: 50%; }
.col-xs-7  { width: 58.3333%; }
.col-xs-8  { width: 66.6667%; }
.col-xs-9  { width: 75%; }
.col-xs-10 { width: 83.3333%; }
.col-xs-11 { width: 91.6667%; }
.col-xs-12 { width: 100%; }

/* xs offsets */
.col-xs-offset-1  { margin-left: 8.3333%; }
.col-xs-offset-2  { margin-left: 16.6667%; }
.col-xs-offset-3  { margin-left: 25%; }
.col-xs-offset-4  { margin-left: 33.3333%; }
.col-xs-offset-5  { margin-left: 41.6667%; }
.col-xs-offset-6  { margin-left: 50%; }

/* md columns (768px+) */
@media (min-width: 768px) {
    .col-md-1  { width: 8.3333%; }
    .col-md-2  { width: 16.6667%; }
    .col-md-3  { width: 25%; }
    .col-md-4  { width: 33.3333%; }
    .col-md-5  { width: 41.6667%; }
    .col-md-6  { width: 50%; }
    .col-md-7  { width: 58.3333%; }
    .col-md-8  { width: 66.6667%; }
    .col-md-9  { width: 75%; }
    .col-md-10 { width: 83.3333%; }
    .col-md-11 { width: 91.6667%; }
    .col-md-12 { width: 100%; }
    .col-md-offset-0 { margin-left: 0; }
    .col-md-offset-1 { margin-left: 8.3333%; }
    .col-md-offset-2 { margin-left: 16.6667%; }
    .col-md-offset-3 { margin-left: 25%; }
    .col-md-offset-4 { margin-left: 33.3333%; }
    .col-md-offset-5 { margin-left: 41.6667%; }
    .col-md-offset-6 { margin-left: 50%; }
}

/* lg columns (1200px+) */
@media (min-width: 1200px) {
    .col-lg-1  { width: 8.3333%; }
    .col-lg-2  { width: 16.6667%; }
    .col-lg-3  { width: 25%; }
    .col-lg-4  { width: 33.3333%; }
    .col-lg-5  { width: 41.6667%; }
    .col-lg-6  { width: 50%; }
    .col-lg-7  { width: 58.3333%; }
    .col-lg-8  { width: 66.6667%; }
    .col-lg-9  { width: 75%; }
    .col-lg-10 { width: 83.3333%; }
    .col-lg-11 { width: 91.6667%; }
    .col-lg-12 { width: 100%; }
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.42;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 6px;
    user-select: none;
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.btn:focus {
    outline: none;
}

.btn.disabled, .btn[disabled] {
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
}

.btn-xs {
    padding: 1px 5px;
    font-size: 12px;
    line-height: 1.5;
    border-radius: 4px;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 13px;
    border-radius: 5px;
}

.btn-lg {
    padding: 10px 18px;
    font-size: 18px;
    border-radius: 8px;
}

.btn-group {
    display: inline-flex;
}

.btn-group > .btn {
    border-radius: 0;
}

.btn-group > .btn:first-child {
    border-radius: 6px 0 0 6px;
}

.btn-group > .btn:last-child {
    border-radius: 0 6px 6px 0;
}

/* --- Forms --- */
.form-control {
    display: block;
    width: 100%;
    padding: 6px 12px;
    font-size: 14px;
    line-height: 1.42;
    color: #444;
    background-color: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
    border-color: #3a8a9e;
    box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.15);
    outline: none;
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.form-group {
    margin-bottom: 8px;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    flex: 1;
    border-radius: 6px 0 0 6px;
}

.input-group-addon {
    padding: 6px 12px;
    font-size: 14px;
    background-color: #f0f2f5;
    border: 1px solid #d0d5dd;
    display: flex;
    align-items: center;
}

.input-group-btn {
    display: flex;
}

.input-group-btn .btn {
    border-radius: 0 6px 6px 0;
}

/* --- Navigation --- */
.navbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 0;
    min-height: auto;
}

.navbar-default {
    background-color: transparent;
    border: none;
}

.navbar-header {
    display: flex;
    align-items: center;
}

.navbar-brand {
    font-weight: 600;
    font-size: 18px;
    padding: 0;
    margin-right: 16px;
    text-decoration: none;
}

.navbar-nav, .nav {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar-left {
    margin-right: auto;
}

.navbar-right {
    margin-left: auto;
}

.nav > li > a {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
}

/* --- Modals --- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.65);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.2s;
}

.modal-backdrop.in {
    opacity: 1;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    overflow: auto;
}

.modal.fade {
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.2s, transform 0.2s;
}

.modal.fade.in {
    opacity: 1;
    transform: translateY(0);
}

.modal-dialog {
    position: relative;
    margin: 30px auto;
}

.modal-lg {
    max-width: 900px;
}

.modal-content {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e8ecf0;
}

.modal-title {
    font-weight: 600;
    font-size: 16px;
    margin: 0;
}

.modal-body {
    padding: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e8ecf0;
}

button.close {
    background: none;
    border: none;
    font-size: 24px;
    font-weight: 300;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

button.close:hover {
    color: #333;
}

/* --- Tables --- */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #e8ecf0;
}

.table-striped tbody tr:nth-child(even) {
    background-color: #f8f9fb;
}

.table-bordered {
    border: 1px solid #e8ecf0;
}

.table-bordered th, .table-bordered td {
    border: 1px solid #e8ecf0;
}

/* --- Text Utilities --- */
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-uppercase { text-transform: uppercase; }

/* --- Float Utilities --- */
.pull-left { float: left; }
.pull-right { float: right; }
.clearfix::after { content: ""; display: table; clear: both; }

/* --- Visibility --- */
.hide, .hidden { display: none !important; }
.show { display: block !important; }
.invisible { visibility: hidden; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* --- Alerts --- */
.alert {
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
}

.alert-success {
    background-color: #ecfdf3;
    color: #067647;
    border: 1px solid #abefc6;
}

.alert-danger {
    background-color: #fef3f2;
    color: #b42318;
    border: 1px solid #fecdca;
}

.alert-warning {
    background-color: #fffaeb;
    color: #93370d;
    border: 1px solid #fedf89;
}

.alert-info {
    background-color: #f0f9ff;
    color: #026aa2;
    border: 1px solid #b2ddff;
}

/* --- Badges & Labels --- */
.badge, .label {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 10px;
    line-height: 1.4;
}

.label-default { background-color: #e8ecf0; color: #444; }
.label-primary { background-color: #d1e5fa; color: #1a5fa8; }
.label-success { background-color: #d1fadf; color: #067647; }
.label-danger  { background-color: #fecdca; color: #b42318; }
.label-warning { background-color: #fedf89; color: #93370d; }
.label-info    { background-color: #b2ddff; color: #026aa2; }

/* --- Progress Bars --- */
.progress {
    height: 16px;
    background-color: #e8ecf0;
    border-radius: 8px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: #3a8a9e;
    border-radius: 8px;
    transition: width 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #fff;
    font-weight: 600;
}

.progress-bar-success { background-color: #32d583; }
.progress-bar-danger  { background-color: #f04438; }
.progress-bar-warning { background-color: #f79009; }

/* --- Page Header --- */
.page-header {
    padding-bottom: 8px;
    margin: 0 0 16px;
    border-bottom: 1px solid #e8ecf0;
}

/* --- Responsive Visibility (Bootstrap 3 compat) --- */
@media (max-width: 767px) {
    .hidden-xs { display: none !important; }
}
@media (min-width: 768px) {
    .visible-xs { display: none !important; }
}
@media (min-width: 768px) and (max-width: 991px) {
    .hidden-sm { display: none !important; }
}
@media (min-width: 992px) and (max-width: 1199px) {
    .hidden-md { display: none !important; }
}
@media (min-width: 1200px) {
    .hidden-lg { display: none !important; }
}
