/**
 * W3.CSS class compatibility — styled with Bootstrap-like components.
 * Lets legacy PHP markup work without loading w3.css.
 * New pages should use Bootstrap classes directly.
 */

/* —— Buttons —— */
.w3-button,
.w3-btn {
    display: inline-block;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    border-radius: 0.375rem;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}

.w3-button:hover,
.w3-btn:hover {
    text-decoration: none;
}

.w3-tiny { font-size: 0.75rem !important; padding: 0.2rem 0.45rem !important; }
.w3-xlarge { font-size: 1.25rem !important; padding: 0.5rem 1rem !important; }

.w3-round { border-radius: 0.375rem !important; }
.w3-round-large { border-radius: 2rem !important; }

.w3-white.w3-button,
.w3-white.w3-btn {
    color: #212529;
    background-color: #fff;
    border-color: #dee2e6;
}

.w3-white.w3-button:hover { background-color: #f8f9fa; }

.w3-border.w3-border-black {
    border-color: #212529 !important;
}

/* —— Colors —— */
.w3-green,
.w3-teal {
    background-color: var(--bs-success, #198754) !important;
    color: #fff !important;
}

.w3-red {
    background-color: var(--bs-danger, #dc3545) !important;
    color: #fff !important;
}

.w3-blue { background-color: var(--bs-primary, #0d6efd) !important; color: #fff !important; }
.w3-orange { background-color: var(--bs-warning, #ffc107) !important; color: #212529 !important; }
.w3-yellow { background-color: #ffc107 !important; color: #212529 !important; }
.w3-grey,
.w3-gray { background-color: #6c757d !important; color: #fff !important; }
.w3-light-grey { background-color: #f8f9fa !important; color: #212529 !important; }
.w3-light-white { background-color: #fff !important; }
.w3-white { background-color: #fff !important; }
.w3-black { background-color: #212529 !important; color: #fff !important; }
.w3-transparent { background-color: transparent !important; }

/* —— Layout —— */
.w3-container {
    padding: 0.75rem 1rem;
}

.w3-container::after,
.w3-row::before,
.w3-row::after,
.w3-bar::before,
.w3-bar::after {
    content: "";
    display: table;
    clear: both;
}

.w3-row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.w3-row > [class*="w3-col"],
.w3-row > .w3-half,
.w3-row > .w3-third,
.w3-row > .w3-quarter {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.w3-half { flex: 0 0 auto; width: 50%; }
.w3-third { flex: 0 0 auto; width: 33.33333%; }
.w3-quarter { flex: 0 0 auto; width: 25%; }

.w3-col.s1 { width: 8.33333%; }
.w3-col.s2 { width: 16.66666%; }
.w3-col.s3 { width: 25%; }
.w3-col.s4 { width: 33.33333%; }
.w3-col.s6 { width: 50%; }
.w3-col.s8 { width: 66.66666%; }
.w3-col.s12 { width: 100%; }

@media (min-width: 601px) {
    .w3-col.m4 { width: 33.33333%; }
    .w3-col.m6 { width: 50%; }
    .w3-col.m8 { width: 66.66666%; }
    .w3-col.m12 { width: 100%; }
}

@media (min-width: 993px) {
    .w3-col.l3 { width: 25%; }
    .w3-col.l4 { width: 33.33333%; }
    .w3-col.l6 { width: 50%; }
    .w3-col.l8 { width: 66.66666%; }
    .w3-col.l12 { width: 100%; }
}

/* —— Bar / nav (legacy) —— */
.w3-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
    overflow: hidden;
}

.w3-bar .w3-bar-item,
.w3-bar .w3-button {
    padding: 0.5rem 1rem;
    display: block;
    border: none;
    background: none;
    outline: none;
    text-align: left;
    white-space: normal;
}

.w3-bar-item {
    padding: 0.5rem 1rem;
    display: inline-block;
    text-align: center;
}

.w3-bar-block .w3-bar-item,
.w3-bar-block .w3-button {
    width: 100%;
    display: block;
    text-align: left;
}

.w3-bar-block.w3-center .w3-bar-item { text-align: center; }

/* —— Cards —— */
.w3-card,
.w3-card-2,
.w3-card-4 {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.w3-card-4 {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* —— Tables —— */
.w3-table,
.w3-table-all {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.w3-table td,
.w3-table th,
.w3-table-all td,
.w3-table-all th {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    text-align: left;
}

.w3-striped tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.03);
}

.w3-responsive {
    overflow-x: auto;
}

/* —— Forms —— */
.w3-input,
.w3-select {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--bs-body-color, #212529);
    background-color: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #ced4da);
    border-radius: 0.375rem;
}

.w3-border { border: 1px solid var(--bs-border-color, #ced4da) !important; }

/* —— Panels —— */
.w3-panel {
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.375rem;
}

/* —— Display —— */
.w3-display-container { position: relative; }
.w3-display-topleft { position: absolute; left: 0; top: 0; }
.w3-display-topright { position: absolute; right: 0; top: 0; }
.w3-display-bottomleft { position: absolute; left: 0; bottom: 0; }
.w3-display-bottomright { position: absolute; right: 0; bottom: 0; }

/* —— Dropdown (hover, legacy) —— */
.w3-dropdown-hover {
    position: relative;
    display: inline-block;
}

.w3-dropdown-hover:hover .w3-dropdown-content {
    display: block;
}

.w3-dropdown-content {
    display: none;
    position: absolute;
    min-width: 160px;
    z-index: 1050;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* —— Sidebar —— */
.w3-sidebar {
    height: 100%;
    position: fixed;
    z-index: 1040;
    overflow: auto;
}

.w3-collapse { display: none; }
.w3-collapse.w3-show { display: block; }

/* —— Spacing (common) —— */
.w3-padding { padding: 0.75rem !important; }
.w3-padding-16 { padding: 1rem !important; }
.w3-padding-24 { padding: 1.5rem !important; }
.w3-margin-top { margin-top: 1rem !important; }

/* —— Visibility —— */
@media (max-width: 600px) {
    .w3-hide-small { display: none !important; }
}

@media (max-width: 992px) {
    .w3-hide-medium { display: none !important; }
}

@media (min-width: 993px) {
    .w3-hide-large { display: none !important; }
}

.w3-mobile { display: block; width: 100%; overflow: auto; }

.w3-image { max-width: 100%; height: auto; }

/* Dark theme adjustments inside Bootstrap dark pages */
[data-bs-theme="dark"] .w3-light-grey {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .w3-input,
[data-bs-theme="dark"] .w3-select {
    background-color: var(--bs-body-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .w3-striped tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .w3-dropdown-content {
    background: var(--bs-body-bg);
    border-color: var(--bs-border-color);
}
