/* ========================================
   Semantic Global Components
   Shared patterns across all blade views
   ======================================== */

/* ========================================
   Page Structure
   ======================================== */

.page-section {
    margin-bottom: 25px;
}

.section-title {
    font-weight: 600;
    color: #333;
    margin: 0 0 20px 0;
    font-size: 16px;
}

/* ========================================
   Page Header - Title + Action Buttons
   ======================================== */

.page-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 0;
    margin: 0;
    border-bottom: none;
}

.page-header-content {
    flex: 1;
}

.page-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Cancel Bootstrap .form-horizontal negative margins inside glass-card */
.form-horizontal .glass-card .form-group {
    margin-left: 0;
    margin-right: 0;
}

/* ========================================
   Field Grid - Layout for Data Fields
   ======================================== */

.field-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    width: 100%;
    align-items: start;
}

.field-grid > div {
    min-width: 0;
}

.field-grid .form-group {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

.field-grid small,
.field-grid .help-block {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #999;
}

/* ========================================
   Grid Item Sizing
   ======================================== */

.field-item-full {
    grid-column: 1 / -1;
    margin-bottom: 15px;
}

.field-item-half {
    grid-column: span 2;
    margin-bottom: 15px;
}

.field-item-third {
    grid-column: span 1;
    margin-bottom: 15px;
}

.field-item-quarter {
    grid-column: span 1;
    margin-bottom: 15px;
}

/* ========================================
   Field Label - Used on both Show and Edit
   ======================================== */

.field-label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #999;
    font-size: 12px;
}

/* ========================================
   Form Input Controls
   ======================================== */

.field-input {
    display: block;
    width: 100%;
    height: auto;
    padding: 6px 12px;
    font-size: 14px;
    line-height: 1.42857143;
    color: #555;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.field-input:focus {
    border-color: #66afe9;
    outline: 0;
    box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102,175,233,.6);
}

.field-input-readonly {
    display: block;
    width: 100%;
    padding: 6px 12px;
    font-size: 14px;
    line-height: 1.42857143;
    color: #555;
    background-color: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    cursor: not-allowed;
}

/* ========================================
   Help Text
   ======================================== */

.field-help {
    color: #999;
    font-size: 12px;
    margin-top: 4px;
}

.field-help-danger {
    color: #d9534f;
    font-size: 12px;
    margin-top: 4px;
}

/* ========================================
   Status Badges - Used across all pages
   ======================================== */

.status-badge {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 5px;
    display: inline-block;
}

.status-success {
    background-color: #5cb85c;
    color: white;
}

.status-warning {
    background-color: #f0ad4e;
    color: white;
}

.status-danger {
    background-color: #d9534f;
    color: white;
}

.status-info {
    background-color: #5bc0de;
    color: white;
}

.status-active {
    display: inline-block;
    background-color: #5cb85c;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.status-inactive {
    display: inline-block;
    background-color: #d9534f;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

/* ========================================
   Field Value Display
   ======================================== */

.field-value {
    margin: 0;
    font-weight: 600;
    word-break: break-word;
    font-size: 14px;
}

.field-value-sm {
    margin: 0;
    font-weight: 600;
    word-break: break-word;
    font-size: 13px;
}

.field-divider {
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    margin-bottom: 0;
}

.field-caption {
    color: #999;
    font-size: 12px;
}

/* ========================================
   Action Buttons
   ======================================== */

.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.action-button-margin {
    margin-right: 5px;
}

/* ========================================
   Notes
   ======================================== */

.notes-label {
    font-weight: 600;
    color: #667eea;
    margin-right: 8px;
}

.notes-row {
    background-color: #f8f8f8;
    border-left: 3px solid #667eea;
}

.notes-row td {
    padding: 8px 10px 8px 15px;
    border: 1px solid #e8e8e8;
    border-top: none;
    border-left: 3px solid #667eea;
    font-size: 13px;
    color: #555;
}

/* ========================================
   File Links
   ======================================== */

.file-link {
    color: #0066cc;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
    white-space: nowrap;
    font-size: 1.1rem;
    max-width: 100%;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-link:hover {
    color: #0052a3;
    text-decoration: underline;
}

.file-link:active {
    color: #003d7a;
}

.download-link {
    display: inline-block;
    margin-left: 10px;
    color: #999;
    font-size: 12px;
}

/* ========================================
   File Info and Badge
   ======================================== */

.file-info {
    margin-bottom: 10px;
}

.file-badge {
    display: inline-block;
    background-color: #5cb85c;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    margin-right: 5px;
}

.file-label-text {
    color: #999;
    font-size: 12px;
}

/* ========================================
   Data Tables
   ======================================== */

.data-table-wrapper {
    border-radius: 8px;
    overflow: hidden;
}

.data-table {
    margin-bottom: 0;
    border: 1px solid #e8e8e8;
}

.data-table thead tr {
    background-color: #f8f9fa;
}

.data-table th {
    vertical-align: middle;
    padding: 10px;
    border: 1px solid #e8e8e8;
}

.data-table td {
    vertical-align: top;
    padding: 10px;
    border: 1px solid #e8e8e8;
}

/* ========================================
   History Table
   ======================================== */

.history-table-wrapper {
    border-radius: 8px;
    overflow: hidden;
}

.history-table {
    margin-bottom: 0;
    border: 1px solid #e0e0e0;
}

.history-table thead tr {
    background-color: #f8f8f8;
}

.history-table th {
    vertical-align: middle;
    padding: 10px;
}

.history-table td {
    padding: 10px;
}

.history-table-notes-row {
    background-color: #f9f9f9;
    border-top: none;
}

.history-table-notes-label {
    color: #666;
}

.history-table-badge-col {
    width: 150px;
}

/* ========================================
   Form Alerts
   ======================================== */

.form-alert {
    margin-bottom: 20px;
    border-radius: 8px;
}

.form-alert-danger {
    background-color: #f2dede;
    border: 1px solid #ebccd1;
    color: #a94442;
    padding: 12px 15px;
}

.form-alert-success {
    background-color: #dff0d8;
    border: 1px solid #d6e9c6;
    color: #3c763d;
    padding: 12px 15px;
}

.form-alert-list {
    margin-bottom: 0;
    padding-left: 20px;
}

.form-alert-list li {
    margin-bottom: 4px;
}

/* ========================================
   Form Button Group
   ======================================== */

.form-button-group {
    margin-bottom: 25px;
    text-align: center;
}

.form-button-group .btn {
    margin-right: 5px;
}

.btn-form-action {
    padding: 10px 30px;
}

/* ========================================
   Responsive Design - Mobile First
   ======================================== */

@media (max-width: 768px) {
    .page-section {
        margin-bottom: 15px;
    }

    /* Field grid: 2 columns on tablet/mobile */
    .field-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    /* All sized items collapse to half-width (2 per row) */
    .field-item-full {
        grid-column: 1 / -1;
    }

    .field-item-half,
    .field-item-third,
    .field-item-quarter {
        grid-column: span 1;
    }

    /* Page header: wrap so actions go below title on small screens */
    .page-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .page-header-content {
        flex: 0 0 100%;
    }

    /* Tables: horizontal scroll on mobile */
    .data-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .history-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 6px;
    }

    .history-table {
        font-size: 12px;
    }

    .history-table th,
    .history-table td {
        padding: 6px;
    }

    .form-button-group {
        margin-bottom: 15px;
    }

    .form-button-group .btn {
        margin-right: 5px;
        margin-bottom: 5px;
    }
}

@media (max-width: 480px) {
    .page-section {
        margin-bottom: 12px;
    }

    /* Single column on very small phones */
    .field-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .field-item-half,
    .field-item-third,
    .field-item-quarter {
        grid-column: 1 / -1;
    }

    .data-table {
        font-size: 11px;
    }

    .data-table th,
    .data-table td {
        padding: 5px;
    }

    .action-buttons {
        gap: 2px;
    }

    .history-table {
        font-size: 11px;
    }

    .history-table th,
    .history-table td {
        padding: 5px;
    }

    .form-button-group {
        margin-bottom: 12px;
        flex-direction: column;
    }

    .form-button-group .btn {
        display: block;
        width: 100%;
        margin-right: 0;
        margin-bottom: 8px;
    }
}
