/* ScribeFlow - Common Styles
 * Consolidated from 14 CSS files to eliminate duplication
 * Total reduction: ~60% (7,445 → ~3,000 lines)
 */

/* =========================================
   1. CSS VARIABLES & THEME SYSTEM
   ========================================= */

:root {
    /* ============================================
       SCRIBEFLOW COLOR SYSTEM - WHITE-LABEL READY
       Change these variables for custom branding
       ============================================ */

    /* Core Brand Colors - Update these for white-labeling */
    --brand-primary: #2B3A52;      /* Navy blue from logo - main brand color */
    --brand-secondary: #4CBFA6;    /* Teal accent from logo - secondary accent */
    --brand-accent: #6DD5ED;       /* Light cyan highlights - accent color */

    /* Legacy aliases for backward compatibility */
    --primary-color: var(--brand-primary);
    --secondary-color: var(--brand-secondary);
    --accent-color: var(--brand-accent);

    /* Semantic Colors */
    --color-success: var(--brand-secondary);  /* Using brand teal */
    --color-warning: #f59e0b;
    --color-error: #dc2626;
    --color-info: #3b82f6;
    --success-color: var(--color-success);
    --warning-color: var(--color-warning);
    --error-color: var(--color-error);

    /* Neutral Palette - Systematic gray scale */
    --neutral-50: #f8f9fa;         /* Lightest gray */
    --neutral-100: #f7fafc;
    --neutral-200: #e5e7eb;
    --neutral-300: #d1d5db;
    --neutral-400: #9ca3af;
    --neutral-500: #6b7280;
    --neutral-600: #4a5568;
    --neutral-700: #374151;
    --neutral-800: #2d3748;
    --neutral-900: #1f2937;
    --neutral-950: #0f172a;        /* Darkest gray */

    /* Surface Colors - Backgrounds and containers */
    --surface-primary: #ffffff;
    --surface-secondary: #f8f9fa;
    --surface-tertiary: #f7fafc;
    --surface-elevated: #ffffff;
    --surface-light: #f5f5f5;

    /* Legacy aliases */
    --surface-color: var(--surface-primary);
    --background-color: #f8f6f3;
    --nav-background: var(--surface-primary);

    /* Text Colors */
    --text-primary: #2c3e50;       /* Main text */
    --text-secondary: #6b7280;     /* Secondary text */
    --text-muted: #9ca3af;         /* Muted/disabled text */
    --text-inverse: #ffffff;       /* Text on dark backgrounds */
    --text-color: var(--text-primary);

    /* Border Colors */
    --border-light: #e5e7eb;
    --border-default: #d1d5db;
    --border-strong: #9ca3af;
    --border-color: #e8e5e0;

    /* Interactive States */
    --state-hover: #f8f9fa;
    --state-active: #e5e7eb;
    --state-disabled: #9ca3af;
    --hover-bg: var(--state-hover);

    /* Shadows with opacity */
    --shadow-color: var(--brand-primary);
    --shadow-opacity-light: 0.1;
    --shadow-opacity-medium: 0.15;
    --shadow-opacity-dark: 0.3;
    --shadow: 0 2px 10px rgba(43, 58, 82, var(--shadow-opacity-light));
    --shadow-hover: 0 4px 20px rgba(43, 58, 82, var(--shadow-opacity-medium));

    /* Alert colors for light mode - high contrast */
    --alert-success-bg: #d4edda;
    --alert-success-text: #155724;
    --alert-success-border: #c3e6cb;
    --alert-warning-bg: #fff3cd;
    --alert-warning-text: #856404;
    --alert-warning-border: #ffeaa7;
    --alert-error-bg: #f8d7da;
    --alert-error-text: #721c24;
    --alert-error-border: #f5c6cb;
    --alert-info-bg: #cce5ff;
    --alert-info-text: #004085;
    --alert-info-border: #b8daff;
}

/* ============================================
   DARK THEME - Automatic dark mode support
   ============================================ */
[data-theme="dark"] {
    /* Core Brand Colors - Adjusted for dark mode visibility with better contrast */
    --brand-primary: #6B7FC5;      /* Brighter blue for better visibility (was #3B4A63) */
    --brand-secondary: #4CBFA6;    /* Keep teal for accents */
    --brand-accent: #6DD5ED;       /* Keep cyan for highlights */

    /* Update legacy aliases */
    --primary-color: var(--brand-primary);
    --secondary-color: var(--brand-secondary);
    --accent-color: var(--brand-accent);

    /* Semantic Colors - Brighter for dark backgrounds */
    --color-success: #6DD5ED;      /* Cyan for success (more visible) */
    --color-warning: #fbbf24;
    --color-error: #f87171;
    --color-info: #60a5fa;
    --success-color: var(--color-success);
    --warning-color: var(--color-warning);
    --error-color: var(--color-error);

    /* Neutral Palette - Better contrast for dark mode */
    --neutral-50: #0f172a;
    --neutral-100: #1a1a1a;
    --neutral-200: #262626;
    --neutral-300: #404040;
    --neutral-400: #525252;
    --neutral-500: #737373;
    --neutral-600: #a3a3a3;
    --neutral-700: #4a5568;        /* Darker gray for better gradients (was #d4d4d4) */
    --neutral-800: #374151;        /* Medium-dark gray (was #e5e5e5) */
    --neutral-900: #2d3748;        /* Dark blue-gray for backgrounds (was #f5f5f5) */
    --neutral-950: #1f2937;        /* Darkest for deep backgrounds (was #fafafa) */

    /* Surface Colors - Blue-gray tone for cohesion */
    --surface-primary: #2d3748;    /* Nice blue-gray from dashboard */
    --surface-secondary: #374151;  /* Slightly lighter */
    --surface-tertiary: #1f2937;   /* Darker variant */
    --surface-elevated: #374151;
    --surface-light: #3a3a3a;

    /* Legacy aliases */
    --surface-color: var(--surface-primary);
    --background-color: #1a1a1a;
    --nav-background: var(--surface-primary);

    /* Text Colors - Brighter for better readability */
    --text-primary: #f0f0f0;       /* Brighter main text (was #e8e8e8) */
    --text-secondary: #b8b8b8;     /* Brighter secondary text (was #b0b0b0) */
    --text-muted: #888888;
    --text-inverse: #1a1a1a;
    --text-color: var(--text-primary);

    /* Border Colors */
    --border-light: #404040;
    --border-default: #525252;
    --border-strong: #737373;
    --border-color: var(--border-light);

    /* Interactive States */
    --state-hover: #404040;
    --state-active: #525252;
    --state-disabled: #525252;
    --hover-bg: var(--state-hover);

    /* Shadows - Darker for dark mode */
    --shadow-opacity-light: 0.3;
    --shadow-opacity-medium: 0.4;
    --shadow-opacity-dark: 0.6;
    --shadow: 0 2px 10px rgba(0, 0, 0, var(--shadow-opacity-light));
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, var(--shadow-opacity-medium));

    /* Alert colors for dark mode - high contrast with ScribeFlow palette */
    --alert-success-bg: #1a3b47;
    --alert-success-text: #6DD5ED;
    --alert-success-border: #4CBFA6;
    --alert-warning-bg: #4d3800;
    --alert-warning-text: #ffd23d;
    --alert-warning-border: #5c4200;
    --alert-error-bg: #5c1e24;
    --alert-error-text: #f5a3a8;
    --alert-error-border: #6d2328;
    --alert-info-bg: #004085;
    --alert-info-text: #9ec5fe;
    --alert-info-border: #0056b3;
}

/* Dark mode specific component overrides */
[data-theme="dark"] .page-header h1 {
    color: var(--text-primary);  /* Use bright text instead of dark brand color */
}

[data-theme="dark"] .page-header h1 i {
    color: var(--brand-accent);  /* Use cyan instead of teal for better visibility */
}

[data-theme="dark"] .projects-title {
    color: var(--text-primary);  /* Project titles also need bright text */
}

/* =========================================
   2. BASE STYLES & RESET
   ========================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
}

/* =========================================
   3. LAYOUT COMPONENTS
   ========================================= */

/* Dashboard Container - Used in 8 files */
.dashboard-container {
    width: 100%;
    margin: 2rem 0;
    padding: 0 2rem !important;
    min-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
}

/* Page Header - Used in 6 files */
.page-header {
    background: var(--surface-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 2rem;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-header h1 i {
    color: var(--secondary-color);
    font-size: 1.75rem;
}

/* Breadcrumb - Used in 6 files */
.breadcrumb {
    margin-bottom: 1rem;
}

.breadcrumb-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.breadcrumb-link:hover {
    color: var(--primary-color);
    background: var(--surface-color);
    border-color: var(--primary-color);
    text-decoration: none;
    transform: translateX(-2px);
}

.breadcrumb-link i {
    font-size: 0.875rem;
    transition: transform 0.2s ease;
}

.breadcrumb-link:hover i {
    transform: translateX(-2px);
}

/* =========================================
   4. BUTTON SYSTEM - UNIFIED IMPLEMENTATION
   ========================================= */

/* Base Button Class - Single source of truth */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.4;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    white-space: nowrap;
    position: relative;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Button Variants */
.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--text-secondary);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #3da892;
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background: #d68910;
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.btn-danger {
    background: #c0392b; /* More subdued red instead of bright error color */
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #a93226; /* Darker red on hover */
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

/* Dark theme danger button adjustments */
[data-theme="dark"] .btn-danger {
    background: #922b21; /* Even more subdued red for dark mode */
    color: white;
}

[data-theme="dark"] .btn-danger:hover:not(:disabled) {
    background: #7b241c; /* Darker red on hover in dark mode */
}

/* Button Sizes */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Action Buttons - SINGLE IMPLEMENTATION */
.action-btn {
    padding: 8px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.2;
}

.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.action-btn-primary {
    background: var(--primary-color);
    color: white;
}

.action-btn-primary:hover:not(:disabled) {
    background: var(--accent-color);
    transform: translateY(-1px);
}

.action-btn-secondary {
    background: var(--surface-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.action-btn-secondary:hover:not(:disabled) {
    background: var(--hover-bg);
    transform: translateY(-1px);
}

.action-btn-danger {
    background: var(--error-color);
    color: white;
}

.action-btn-danger:hover:not(:disabled) {
    background: #c53030;
    transform: translateY(-1px);
}

.action-btn-success {
    background: var(--success-color);
    color: white;
}

.action-btn-success:hover:not(:disabled) {
    background: #3da892;
    transform: translateY(-1px);
}

/* Button Size Modifiers */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.action-btn-sm {
    padding: 6px 10px;
    font-size: 0.8em;
}

/* =========================================
   5. FORM COMPONENTS
   ========================================= */

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.5;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(45, 90, 87, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:disabled {
    background: var(--surface-light);
    opacity: 0.6;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

/* Legacy form-input class for backward compatibility (used in projects page) */
.form-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--background-color);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.form-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
}

.form-check-label {
    margin: 0;
    cursor: pointer;
    font-weight: 400;
}

/* =========================================
   6. MODAL SYSTEM - UNIFIED IMPLEMENTATION
   ========================================= */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--surface-color);
    border-radius: 12px;
    box-shadow: var(--shadow-hover);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Delete Warning Modal Styles */
.delete-warning {
    text-align: center;
    padding: 40px 30px;
    margin-bottom: 0;
}

.delete-warning i {
    font-size: 4rem;
    color: var(--error-color);
    margin-bottom: 25px;
    display: block;
}

.delete-warning p {
    margin: 0 0 20px 0;
    font-size: 1.2rem;
    line-height: 1.6;
    color: var(--text-primary);
    font-weight: 500;
}

.delete-warning .warning-text {
    font-size: 1rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 0;
    line-height: 1.5;
}

/* Highlighted item display for modals and confirmations - reusable component */
.highlighted-item {
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px 20px;
    margin: 20px 0;
    word-break: break-word;
    overflow-wrap: break-word;
    font-weight: 600;
    color: var(--primary-color);
    text-align: center;
    max-width: 100%;
    font-size: 1.1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Modal action buttons container - consistent across all modals */
.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding-top: 10px;
}

/* =========================================
   7. ALERT & NOTIFICATION SYSTEM
   ========================================= */

.alert {
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert i {
    font-size: 1.125rem;
    flex-shrink: 0;
}

.alert-success {
    background: var(--alert-success-bg);
    color: var(--alert-success-text);
    border-color: var(--alert-success-border);
}

.alert-warning {
    background: var(--alert-warning-bg);
    color: var(--alert-warning-text);
    border-color: var(--alert-warning-border);
}

.alert-error {
    background: var(--alert-error-bg);
    color: var(--alert-error-text);
    border-color: var(--alert-error-border);
}

.alert-info {
    background: var(--alert-info-bg);
    color: var(--alert-info-text);
    border-color: var(--alert-info-border);
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-hover);
    z-index: 1050;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 400px;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    background: var(--alert-success-bg);
    color: var(--alert-success-text);
    border: 1px solid var(--alert-success-border);
}

.toast-warning {
    background: var(--alert-warning-bg);
    color: var(--alert-warning-text);
    border: 1px solid var(--alert-warning-border);
}

.toast-error {
    background: var(--alert-error-bg);
    color: var(--alert-error-text);
    border: 1px solid var(--alert-error-border);
}

/* Enhanced Toast Notifications - Global System */
.alert-toast {
    position: fixed;
    right: 20px;
    z-index: 10000;
    min-width: 300px;
    max-width: 400px;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.alert-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.alert-toast i:first-child {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.alert-toast .toast-message {
    flex: 1;
    margin-right: 8px;
}

.alert-toast .toast-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0.7;
    transition: opacity 0.2s ease, background-color 0.2s ease;
    flex-shrink: 0;
}

.alert-toast .toast-close:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

.alert-toast.alert-success {
    background: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
}

.alert-toast.alert-error {
    background: var(--error-color);
    color: white;
    border: 1px solid var(--error-color);
}

.alert-toast.alert-warning {
    background: #f59e0b;
    color: white;
    border: 1px solid #f59e0b;
}

.alert-toast.alert-info {
    background: #6b7280;
    color: white;
    border: 1px solid #6b7280;
}

/* Mobile responsive toasts */
@media (max-width: 768px) {
    .alert-toast {
        right: 10px;
        left: 10px;
        min-width: unset;
        max-width: unset;
        width: calc(100% - 20px);
        transform: translateY(-100%);
    }

    .alert-toast.show {
        transform: translateY(0);
    }
}

/* =========================================
   8. TABLE COMPONENTS
   ========================================= */

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table th {
    background: var(--surface-light);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.table tbody tr:hover {
    background: var(--hover-bg);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Projects Table Specific */
.projects-table {
    width: 100%;
    margin-top: 1rem;
}

.projects-table th {
    cursor: pointer;
    user-select: none;
}

.projects-table th:hover {
    background: var(--hover-bg);
}

.projects-table th i {
    margin-left: 0.5rem;
    opacity: 0.6;
}

.projects-table .actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* =========================================
   9. LOADING STATES
   ========================================= */

.loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

.spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow-hover);
}

.loading-content .spinner {
    width: 2rem;
    height: 2rem;
    border-width: 3px;
    margin-bottom: 1rem;
}

/* =========================================
   10. UTILITY CLASSES
   ========================================= */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-danger { color: var(--error-color); }

.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }

.flex-column { flex-direction: column; }
.flex-row { flex-direction: row; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.align-items-end { align-items: flex-end; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-around { justify-content: space-around; }
.justify-content-start { justify-content: flex-start; }
.justify-content-end { justify-content: flex-end; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }

.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 0.75rem; }
.m-4 { margin: 1rem; }
.m-5 { margin: 1.25rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }

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

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

.ml-0 { margin-left: 0; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-3 { margin-left: 0.75rem; }
.ml-4 { margin-left: 1rem; }
.ml-5 { margin-left: 1.25rem; }

.mr-0 { margin-right: 0; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-3 { margin-right: 0.75rem; }
.mr-4 { margin-right: 1rem; }
.mr-5 { margin-right: 1.25rem; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

.border { border: 1px solid var(--border-color); }
.border-top { border-top: 1px solid var(--border-color); }
.border-bottom { border-bottom: 1px solid var(--border-color); }
.border-left { border-left: 1px solid var(--border-color); }
.border-right { border-right: 1px solid var(--border-color); }
.border-0 { border: none; }

.rounded { border-radius: 8px; }
.rounded-sm { border-radius: 4px; }
.rounded-lg { border-radius: 12px; }
.rounded-full { border-radius: 50%; }

.shadow { box-shadow: var(--shadow); }
.shadow-hover { box-shadow: var(--shadow-hover); }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =========================================
   11. RESPONSIVE DESIGN PATTERNS
   ========================================= */

@media (max-width: 768px) {
    .dashboard-container {
        padding: 0 1rem;
        margin: 1rem 0;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .btn:not(.btn-sm) {
        padding: 1rem;
        font-size: 1rem;
    }

    .action-btn {
        font-size: 0.8em;
        padding: 6px 10px;
    }

    .page-header {
        padding: 1rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .modal-content {
        margin: 1rem;
        max-width: none;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .table {
        font-size: 0.9rem;
    }

    .table th,
    .table td {
        padding: 0.5rem;
    }

    .projects-table .actions {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .action-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 1.25rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .breadcrumb-link {
        padding: 0.25rem 0.5rem;
        font-size: 0.85rem;
    }

    .projects-table .actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .action-btn {
        width: 100%;
        justify-content: center;
    }
}

/* =========================================
   12. UTILITY CLASSES
   ========================================= */

.hidden {
    display: none !important;
}

/* =========================================
   13. ENVIRONMENT BADGE SYSTEM (SPLIT LAYOUT)
   ========================================= */

.environment-badge {
    display: none;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-family: 'Courier New', Courier, monospace;
    white-space: nowrap;
}

.environment-badge .badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.7rem;
    line-height: 1.4;
}

.environment-badge .badge-dev {
    background: #f59e0b;
    color: #78350f;
}

.environment-badge .badge-test {
    background: #3b82f6;
    color: #ffffff;
}

.environment-badge .badge-info {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* Production: text-only display (no colored badge) */
.environment-badge .badge-info-only {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.environment-badge .badge-loading {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Dark mode adjustments */
[data-theme="dark"] .environment-badge .badge-dev {
    background: #fbbf24;
    color: #451a03;
}

[data-theme="dark"] .environment-badge .badge-test {
    background: #60a5fa;
    color: #1e3a8a;
}

[data-theme="dark"] .environment-badge .badge-info {
    color: var(--text-secondary);
}

[data-theme="dark"] .environment-badge .badge-info-only {
    color: var(--text-muted);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .footer-content p {
        text-align: center;
    }

    .environment-badge {
        font-size: 0.7rem;
    }

    .environment-badge .badge {
        font-size: 0.65rem;
        padding: 0.1rem 0.4rem;
    }

    .environment-badge .badge-info,
    .environment-badge .badge-info-only {
        font-size: 0.65rem;
    }
}