/* ============================================
   LATIVIQ - PAGE-SPECIFIC PATTERNS
   Ready-to-use CSS for common page layouts
   ============================================ */

/* ========== DASHBOARD PAGES ========== */

.dashboard-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    transition: all var(--transition-fast);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-wrapper i {
    font-size: 1.75rem;
    color: white;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-change {
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--error);
}

.stat-change.neutral {
    color: var(--text-tertiary);
}

/* ========== LIST/TABLE PAGES ========== */

.page-container {
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.page-header p {
    color: var(--text-secondary);
    margin: 0.5rem 0 0 0;
}

.page-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.filters-bar {
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-input-wrapper {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-input-wrapper i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

.search-input-wrapper input {
    padding-left: 2.75rem;
    width: 100%;
}

.filter-select {
    min-width: 180px;
}

/* Enhanced Table Styles */
.table-wrapper {
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.table-modern {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.table-modern thead {
    background: var(--bg-secondary);
}

.table-modern thead th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-primary);
}

.table-modern tbody tr {
    border-bottom: 1px solid var(--border-primary);
    transition: background-color var(--transition-fast);
}

.table-modern tbody tr:hover {
    background-color: var(--bg-tertiary);
}

.table-modern tbody tr:last-child {
    border-bottom: none;
}

.table-modern tbody td {
    padding: 1rem 1.25rem;
    color: var(--text-primary);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.table-actions button,
.table-actions a {
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.pagination-wrapper {
    padding: 1.25rem;
    border-top: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pagination {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination button {
    min-width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--border-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination button:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--brand-primary);
}

.pagination button.active {
    background: var(--brand-primary);
    color: white;
    border-color: var(--brand-primary);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== FORM PAGES ========== */

.form-container {
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.form-modern {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-section {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-primary);
}

.form-section:last-child {
    border-bottom: none;
}

.form-section-header {
    margin-bottom: 1.25rem;
}

.form-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.form-section-description {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-primary);
    margin-top: 1.5rem;
}

/* ========== DETAIL/SHOW PAGES ========== */

.detail-container {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.detail-header {
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 2rem;
}

.detail-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.detail-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.detail-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.detail-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-meta-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.detail-meta-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.detail-section {
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
}

.detail-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-primary);
}

.detail-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ========== EMPTY STATES ========== */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--text-tertiary);
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.empty-state p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* ========== LOADING STATES ========== */

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    min-height: 400px;
}

.loading-container .spinner-modern {
    margin-bottom: 1.5rem;
}

.loading-container p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.skeleton-box {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

.skeleton-box::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-shimmer);
    animation: shimmer 2s infinite;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.75rem;
}

.skeleton-text.large {
    height: 1.5rem;
}

.skeleton-text.small {
    height: 0.75rem;
}

/* ========== RESPONSIVE UTILITIES ========== */

@media (max-width: 992px) {
    .dashboard-container,
    .page-container,
    .form-container,
    .detail-container {
        padding: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 768px) {
    .filters-bar {
        flex-direction: column;
    }
    
    .search-input-wrapper,
    .filter-select {
        width: 100%;
    }
    
    .table-wrapper {
        overflow-x: auto;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column-reverse;
    }
    
    .form-actions button {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .stat-icon-wrapper {
        margin: 0 auto;
    }
    
    .table-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .table-actions button,
    .table-actions a {
        width: 100%;
        justify-content: center;
    }
    
    .pagination-wrapper {
        flex-direction: column;
        gap: 1rem;
    }
}
