/* ====================================
   VIEWS MANAGEMENT (DB_VIEW / DB_VIEW_COLUMN)
   ==================================== */

:root {
    --vw-primary: #005068;
    --vw-primary-dark: #003d5c;
    --vw-success: #28a745;
    --vw-danger: #dc3545;
}

.vw-page {
    padding: 30px;
    font-family: 'Saira Condensed', sans-serif;
}

.vw-page h1 {
    color: var(--vw-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.vw-intro {
    color: #555;
    max-width: 90%;
    line-height: 1.55;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.vw-intro code {
    background: #eef2f4;
    padding: 1px 5px;
    border-radius: 3px;
    color: var(--vw-primary-dark);
}

.vw-alert:not(:empty) {
    margin-bottom: 15px;
}

/* ---------- Buttons ---------- */
.vw-btn {
    font-family: inherit;
    font-size: 0.9rem;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background .2s ease, opacity .2s ease;
}

.vw-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.vw-btn-primary {
    background: var(--vw-primary);
    color: #fff;
}

.vw-btn-primary:hover:not(:disabled) {
    background: var(--vw-primary-dark);
}

.vw-btn-add {
    background: var(--vw-success);
    color: #fff;
    padding: 6px 12px;
    font-size: .85rem;
}

.vw-btn-add:hover:not(:disabled) {
    background: #218838;
}

.vw-btn-danger {
    background: var(--vw-danger);
    color: #fff;
}

.vw-btn-danger:hover:not(:disabled) {
    background: #c82333;
}

/* ---------- Alerts (charte commune) ---------- */
.vw-alert .alert,
.alert {
    padding: 12px 15px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.vw-alert .alert-success,
.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.vw-alert .alert-error,
.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ---------- Toolbar ---------- */
.vw-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    padding: 12px 15px;
    background: #f5f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.vw-toolbar-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.vw-toolbar label {
    font-weight: 600;
    color: var(--vw-primary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ---------- Tables : scroll horizontal + vertical ---------- */
.vw-table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 300px;
    max-width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .06);
    background: #fff;
}

.vw-table-wrap-columns {
    max-height: 430px;
}

.vw-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.vw-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.vw-table thead th {
    background: var(--vw-primary);
    color: #fff;
    padding: 8px 10px;
    text-align: left;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .4px;
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.vw-table td {
    padding: 5px 8px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    white-space: nowrap;
}

.vw-table tbody tr:hover {
    background: #f5f9fa;
}

.vw-th-sm {
    min-width: 90px;
}

.vw-th-xs {
    min-width: 70px;
}

.vw-th-actions {
    min-width: 80px;
    position: sticky;
    right: 0;
}

.vw-req {
    color: #ffc107;
}

/* ---------- Inputs ---------- */
.vw-input {
    min-width: 130px;
    padding: 5px 7px;
    border: 1px solid #cfd6d9;
    border-radius: 4px;
    font-family: inherit;
    font-size: .85rem;
    box-sizing: border-box;
}

.vw-input:focus {
    outline: none;
    border-color: var(--vw-primary);
    box-shadow: 0 0 0 3px rgba(0, 80, 104, .1);
}

.vw-input-sm {
    width: 90px;
    min-width: 90px;
}

.vw-input-xs {
    width: 75px;
    min-width: 75px;
}

.vw-center {
    text-align: center;
}

.vw-check {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--vw-primary);
}

.vw-empty {
    text-align: center;
    color: #999;
    padding: 20px !important;
    font-style: italic;
}

.vw-row-new {
    background: #fffbea;
}

/* ---------- Actions par ligne ---------- */
.vw-row-actions {
    white-space: nowrap;
    text-align: center;
    position: sticky;
    right: 0;
    background: #fff;
}

.vw-btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--vw-primary);
    padding: 4px 6px;
    font-size: .95rem;
    border-radius: 4px;
}

.vw-btn-icon:hover {
    background: #eef2f4;
}

.vw-btn-del {
    color: var(--vw-danger);
}

/* ---------- Champs SQL dans la table DB_VIEW ---------- */
.vw-table-view td textarea {
    resize: vertical;
    font-family: inherit;
    font-size: .85rem;
    padding: 5px 7px;
    min-width: 220px;
    min-height: 31px;
    height: 31px;
    line-height: 1.35;
    overflow-y: auto;
}

.vw-toolbar select {
    font-family: inherit;
    font-size: .95rem;
    padding: 7px 10px;
    border: 1px solid #cfd6d9;
    border-radius: 4px;
    min-width: 320px;
    background: #fff;
}

.vw-toolbar select:focus {
    outline: none;
    border-color: var(--vw-primary);
    box-shadow: 0 0 0 3px rgba(0, 80, 104, .1);
}

/* ---------- Sections ---------- */
.vw-section {
    margin-bottom: 35px;
}

.vw-section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.vw-section-header h2 {
    color: var(--vw-primary);
    font-size: 1.2rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.vw-section-desc {
    color: #666;
    font-size: .9rem;
    flex: 1;
    min-width: 200px;
}
