/* 
 * Contract Management Design System
 * Consistent styling for cards, badges, statistics, and activity logs
 */

/* ===== Dashboard Header ===== */
.dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.dashboard-header h2 {
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
}

.dashboard-header p {
    margin: 0;
    opacity: 0.9;
}

/* ===== Status Badges ===== */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-active {
    background-color: #d4edda;
    color: #155724;
}

.status-expired {
    background-color: #f8d7da;
    color: #721c24;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-inactive {
    background-color: #e2e3e5;
    color: #383d41;
}

.status-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.status-warning {
    background-color: #fff3cd;
    color: #856404;
}

.status-success {
    background-color: #d4edda;
    color: #155724;
}

.status-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* ===== Alerts ===== */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* ===== Statistics Cards ===== */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #007bff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stat-card.success {
    border-left-color: #28a745;
}

.stat-card.danger {
    border-left-color: #dc3545;
}

.stat-card.warning {
    border-left-color: #ffc107;
}

.stat-card.info {
    border-left-color: #17a2b8;
}

.stat-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 0.875rem;
    color: #6c757d;
    text-transform: uppercase;
    font-weight: 600;
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #212529;
}

.stat-card .subtext {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

/* ===== Quick Action Cards ===== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.quick-action-card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.quick-action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.quick-action-card h3 {
    margin: 0 0 0.5rem 0;
    color: #212529;
    font-size: 1.25rem;
}

.quick-action-card p {
    margin: 0 0 1rem 0;
    color: #6c757d;
    font-size: 0.875rem;
}

/* ===== Progress Bars ===== */
.progress {
    width: 100%;
    height: 20px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar {
    height: 100%;
    background-color: #28a745;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
}

.progress-bar.warning {
    background-color: #ffc107;
}

.progress-bar.danger {
    background-color: #dc3545;
}

.progress-bar.info {
    background-color: #17a2b8;
}

/* ===== Section Cards ===== */
.section-card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.section-card h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #212529;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

/* ===== Activity Log ===== */
.activity-log {
    max-height: 500px;
    overflow-y: auto;
}

.activity-item {
    padding: 0.75rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.activity-icon.create {
    background-color: #d4edda;
    color: #155724;
}

.activity-icon.update {
    background-color: #d1ecf1;
    color: #0c5460;
}

.activity-icon.delete {
    background-color: #f8d7da;
    color: #721c24;
}

.activity-icon.payment {
    background-color: #fff3cd;
    color: #856404;
}

.activity-content {
    flex: 1;
}

.activity-action {
    font-weight: 600;
    color: #212529;
}

.activity-time {
    font-size: 0.875rem;
    color: #6c757d;
}

/* ===== Container Wrappers ===== */
.container-white {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-top: 1rem;
}

/* ===== Table Enhancements ===== */
.table-enhanced {
    width: 100%;
    border-collapse: collapse;
}

.table-enhanced thead th {
    background-color: #f8f9fa;
    font-weight: 600;
    padding: 0.75rem;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
}

.table-enhanced tbody tr {
    border-bottom: 1px solid #e9ecef;
}

.table-enhanced tbody tr:hover {
    background-color: #f8f9fa;
}

.table-enhanced tbody td {
    padding: 0.75rem;
}

/* ===== Print Styles ===== */
@media print {
    .btn-primary, 
    .btn-secondary, 
    .btn-icon, 
    button, 
    .header-actions a,
    .quick-actions,
    .no-print {
        display: none !important;
    }
    
    .section-card,
    .stat-card,
    .quick-action-card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    .dashboard-header {
        background: #667eea;
        color: white;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .stat-cards {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .dashboard-header {
        padding: 1.5rem;
    }
    
    .dashboard-header h2 {
        font-size: 1.5rem;
    }

    .dashboard-2col {
        grid-template-columns: 1fr;
    }
}

/* ===== Utility Classes ===== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: #6c757d;
}

.text-success {
    color: #28a745;
}

.text-danger {
    color: #dc3545;
}

.text-warning {
    color: #856404;
}

.text-info {
    color: #17a2b8;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.font-weight-bold {
    font-weight: 700;
}

.font-weight-semibold {
    font-weight: 600;
}

.font-size-sm {
    font-size: 0.875rem;
}

.font-size-lg {
    font-size: 1.25rem;
}

/* ===== Loading States ===== */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== Utility Classes ===== */

/* Flexbox Utilities */
.flex-row {
    display: flex;
    flex-direction: row;
}

.flex-column {
    display: flex;
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.align-start {
    align-items: flex-start;
}

.align-center {
    align-items: center;
}

.align-end {
    align-items: flex-end;
}

.justify-start {
    justify-content: flex-start;
}

.justify-center {
    justify-content: center;
}

.justify-end {
    justify-content: flex-end;
}

.justify-between {
    justify-content: space-between;
}

.justify-around {
    justify-content: space-around;
}

/* Spacing Utilities */
.gap-xs {
    gap: 0.25rem;
}

.gap-sm {
    gap: 0.5rem;
}

.gap-md {
    gap: 1rem;
}

.gap-lg {
    gap: 1.5rem;
}

.gap-xl {
    gap: 2rem;
}

/* Margin Utilities */
.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 1rem; }
.m-4 { margin: 1.5rem; }
.m-5 { margin: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 2rem; }

.ml-0 { margin-left: 0; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-3 { margin-left: 1rem; }
.ml-auto { margin-left: auto; }

.mr-0 { margin-right: 0; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-3 { margin-right: 1rem; }
.mr-auto { margin-right: auto; }

/* Padding Utilities */
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 2rem; }

/* Text Utilities */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Display Utilities */
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.hidden { display: none; }

/* Cursor Utilities */
.cursor-pointer {
    cursor: pointer;
    user-select: none;
}

/* Collapsible Section Utilities */
.collapsible-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.collapsible-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.collapsible-content {
    display: none;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsible-content.expanded {
    display: block;
    max-height: none;
    overflow: visible;
}

/* Grid Utilities */
.grid {
    display: grid;
}

.grid-2-col {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.grid-3-col {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.grid-4-col {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.dashboard-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ===== Quick Actions Bar ===== */
.quick-actions-bar {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
}

.quick-actions-bar h3 {
    color: #333;
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border-bottom: none;
    padding-bottom: 0;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.5rem;
}

.quick-action-card {
    background: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.quick-action-card.type-warning { border-left: 3px solid #ffc107; }
.quick-action-card.type-danger { border-left: 3px solid #dc3545; }
.quick-action-card.type-info { border-left: 3px solid #17a2b8; }

.quick-action-content { display: flex; align-items: center; gap: 0.5rem; flex: 1; }
.quick-action-icon { font-size: 1.1rem; }
.quick-action-message { font-weight: 600; color: #333; font-size: 0.85rem; }

.quick-action-btn {
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.8rem;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.quick-action-btn:hover { opacity: 0.9; }
.quick-action-btn.type-warning { background: #ffc107; }
.quick-action-btn.type-danger { background: #dc3545; }
.quick-action-btn.type-info { background: #17a2b8; }

/* Settings Page Utilities */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.card-title {
    margin: 0 0 0.25rem 0;
}

.card-desc {
    font-size: 0.875rem;
    color: #6c757d;
    margin: 0;
}
