/* style.css */

* { 
    box-sizing: border-box; 
}

:root {
    --bg-main: #0d1117; 
    --bg-card: #161b22; 
    --border-color: #30363d;
    --text-primary: #c9d1d9; 
    --text-secondary: #8b949e; 
    --accent-blue: #58a6ff;
    --btn-green: #2ea44f; 
    --status-active: #3fb950; 
    --status-inactive: #f85149; 
    --btn-cancel: #21262d;
}

body { 
    background-color: var(--bg-main); 
    color: var(--text-primary); 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; 
    margin: 0; 
    padding: 20px; 
}

.container { 
    max-width: 1900px; 
    margin: 0 auto; 
}

header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px; 
    border-bottom: 1px solid var(--border-color); 
    padding-bottom: 15px; 
    flex-wrap: wrap;
    gap: 15px;
}

/* User Profile Badge */
.user-badge { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    background: #21262d; 
    padding: 8px 15px; 
    border-radius: 20px; 
    border: 1px solid var(--border-color); 
}

.user-icon { 
    width: 24px; 
    height: 24px; 
    background: var(--accent-blue); 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: #fff; 
    font-size: 11px; 
    font-weight: bold; 
}

/* Buttons */
.btn-primary { 
    background: var(--btn-green); 
    color: white; 
    border: 1px solid rgba(27,31,35,0.15); 
    padding: 10px 24px; 
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: 600; 
    font-size: 14px;
    height: 38px; /* Standardized height for alignment */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-cancel { 
    background: var(--btn-cancel); 
    color: #c9d1d9; 
    border: 1px solid var(--border-color); 
    padding: 10px 24px; 
    border-radius: 6px; 
    cursor: pointer; 
}

.btn-icon { 
    background: none; 
    border: none; 
    cursor: pointer; 
    font-size: 18px; 
    padding: 4px; 
    transition: 0.2s; 
    border-radius: 4px; 
    color: var(--text-primary); 
}

.btn-icon:hover { 
    background: #30363d; 
}

/* Filter Section - Alignment Fixed */
.filter-card { 
    background: var(--bg-card); 
    border: 1px solid var(--border-color); 
    padding: 20px; 
    border-radius: 6px; 
    margin-bottom: 20px; 
}

.filter-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 15px; 
    align-items: flex-end; /* Ensures button and inputs align at the bottom */
}

/* Override margin for form groups inside the filter grid to prevent misalignment */
.filter-grid .form-group {
    margin-bottom: 0;
}

/* Table Section */
.table-container { 
    background: var(--bg-card); 
    border: 1px solid var(--border-color); 
    border-radius: 6px; 
    overflow-x: auto; 
}

table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 13px; 
}

th { 
    text-align: left; 
    padding: 14px; 
    background: #1c2128; 
    color: var(--text-secondary); 
    border-bottom: 1px solid var(--border-color); 
    font-weight: 600;
}

th[data-sortable] {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

th[data-sortable]:hover {
    color: var(--accent-blue);
}

.sort-indicator {
    font-size: 10px;
    margin-left: 4px;
    display: inline-block;
    min-width: 12px;
}

td { 
    padding: 14px; 
    border-bottom: 1px solid var(--border-color); 
    vertical-align: middle; 
    word-wrap: break-word; 
}

tbody tr:hover {
    background-color: rgba(88, 166, 255, 0.05);
}

.status-badge { 
    font-weight: 800; 
    font-size: 11px; 
    text-transform: uppercase; 
}

/* Pagination */
.pagination-bar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 25px 0; 
    gap: 20px; 
    flex-wrap: wrap;
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-size-selector label {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.page-size-selector select {
    background: #0d1117;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    width: auto;
}

.pagination-controls { 
    display: flex; 
    align-items: center; 
    gap: 5px; 
}

.page-btn { 
    background: #161b22; 
    border: 1px solid var(--border-color); 
    color: var(--text-primary); 
    padding: 8px 14px; 
    text-decoration: none; 
    border-radius: 6px; 
    font-size: 13px; 
    transition: 0.2s; 
}

.page-btn:hover:not(.disabled) { 
    background: #30363d; 
}

.page-btn.active { 
    background: var(--accent-blue); 
    color: #000; 
    font-weight: bold; 
    border-color: var(--accent-blue); 
}

.page-btn.disabled { 
    color: var(--text-secondary); 
    opacity: 0.5; 
    cursor: not-allowed; 
}

.jump-box { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    background: var(--bg-card); 
    padding: 5px 10px; 
    border-radius: 6px; 
    border: 1px solid var(--border-color); 
}

.jump-input { 
    width: 50px; 
    background: #0d1117; 
    border: 1px solid var(--border-color); 
    color: white; 
    padding: 4px; 
    border-radius: 4px; 
    text-align: center; 
}

/* Form Elements */
.form-group { 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
    margin-bottom: 15px; 
}

label { 
    font-size: 11px; 
    color: var(--text-secondary); 
    font-weight: bold; 
    text-transform: uppercase; 
}

label.required::after {
    content: " *";
    color: var(--status-inactive);
}

input, select, textarea { 
    background: #0d1117; 
    border: 1px solid var(--border-color); 
    color: #fff; 
    padding: 10px; 
    border-radius: 6px; 
    width: 100%;
}

/* Toggle Switch */
.switch { 
    position: relative; 
    display: inline-block; 
    width: 46px; 
    height: 22px; 
}

.switch input { 
    opacity: 0; 
    width: 0; 
    height: 0; 
}

.slider { 
    position: absolute; 
    cursor: pointer; 
    top: 0; left: 0; right: 0; bottom: 0; 
    background: #30363d; 
    transition: .3s; 
    border-radius: 20px; 
}

.slider:before { 
    position: absolute; 
    content: ""; 
    height: 16px; 
    width: 16px; 
    left: 3px; 
    bottom: 3px; 
    background: white; 
    transition: .3s; 
    border-radius: 50%; 
}

input:checked + .slider { 
    background: var(--status-active); 
}

input:checked + .slider:before { 
    transform: translateX(24px); 
}

/* Modal Overlay */
.overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0, 0, 0, 0.85); 
    display: none; 
    justify-content: center; 
    align-items: center; 
    z-index: 9999; 
    padding: 20px;
}

/* Ensure overlay displays as flex when shown */
.overlay[style*="display: flex"],
.overlay.show {
    display: flex !important;
}

.modal { 
    background: var(--bg-card); 
    border: 1px solid var(--border-color); 
    width: 95%; 
    max-width: 850px; 
    border-radius: 8px; 
    padding: 35px; 
    max-height: 90vh; 
    overflow-y: auto; 
}

.modal-large { 
    max-width: 1250px; 
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    justify-content: flex-end;
}

.modal-actions .btn-primary,
.modal-actions .btn-cancel {
    margin: 0;
    flex-shrink: 0;
}

/* Responsive Modal Form Grid */
.modal-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

@media (min-width: 768px) {
    .modal-grid {
        grid-template-columns: 1fr 1fr;
    }
    .full-width {
        grid-column: span 2;
    }
}

/* Mobile Breakpoints */
@media (max-width: 600px) {
    .pagination-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Read More Button */
.read-more-btn {
    padding: 4px 8px;
    font-size: 11px;
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid rgba(88, 166, 255, 0.3);
    color: var(--accent-blue);
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.read-more-btn:hover {
    background: rgba(88, 166, 255, 0.2);
    border-color: var(--accent-blue);
}

/* Content cell with flex for read more button */
.content-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-cell span {
    flex: 1;
    word-break: break-word;
}