/* ========================================
   MODERN PROFESSIONAL HOSTING MANAGEMENT CSS
   ======================================== */

/* CSS Custom Properties (Variables) */
:root {
    /* Color Palette - Professional Blue Theme */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --accent-color: #0ea5e9;
    --accent-hover: #0284c7;
    
    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-dark: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-card: #ffffff;
    
    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-white: #ffffff;
    
    /* Border Colors */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --border-focus: #2563eb;
    
    /* Status Colors */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #3b82f6;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
    --transition-slow: 300ms ease-in-out;
}

/* Global Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    line-height: 1.5;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========================================
   LAYOUT COMPONENTS
   ======================================== */

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--bg-sidebar) 0%, #334155 100%);
    color: var(--text-white);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-xl);
    border-right: 1px solid #374151;
}

.sidebar-top {
    padding: var(--spacing-xl);
    flex-grow: 1;
}

.sidebar h2 {
    color: var(--text-white);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xl);
    text-align: center;
    padding-bottom: var(--spacing-lg);
    border-bottom: 2px solid #374151;
}

.sidebar h2 i {
    margin-right: var(--spacing-sm);
    color: var(--accent-color);
}

/* Menu Items */
.sidebar a,
.dropdown-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border: none;
    background: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-xs);
    transition: all var(--transition-fast);
    position: relative;
}

.sidebar a:hover,
.dropdown-btn:hover {
    background-color: #374151;
    color: var(--text-white);
    transform: translateX(2px);
}

.sidebar a.active {
    background-color: var(--primary-color);
    color: var(--text-white);
    box-shadow: var(--shadow-md);
}

.sidebar a i,
.dropdown-btn i {
    width: 20px;
    font-size: 1.1rem;
    color: var(--accent-color);
}

/* Badges */
.badge {
    background: var(--error-color);
    color: var(--text-white);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    margin-left: auto;
    min-width: 1.5rem;
    text-align: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Dropdown Containers */
.dropdown-container {
    display: none;
    flex-direction: column;
    padding-left: var(--spacing-xl);
    margin-top: var(--spacing-xs);
    border-left: 2px solid #374151;
}

.dropdown-container a {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.9rem;
    font-weight: 400;
}

/* Active dropdown state */
.dropdown-container a.active {
    background: rgba(37, 99, 235, 0.15);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
    font-weight: 500;
}

/* Persistent dropdown button state */
.dropdown-btn.dropdown-active {
    background: rgba(37, 99, 235, 0.1);
    border-left: 3px solid var(--primary-color);
}

.dropdown-btn.dropdown-active .fa-chevron-down {
    color: var(--primary-color);
}

.menu-group {
    margin-bottom: var(--spacing-sm);
}

/* Sidebar Bottom */
.sidebar-bottom {
    padding: var(--spacing-xl);
    border-top: 1px solid #374151;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.1) 100%);
}

/* Main Content Area */
.main-content {
    margin-left: 280px;
    flex: 1;
    padding: var(--spacing-2xl);
    background-color: var(--bg-secondary);
    min-height: 100vh;
}

.page-container {
    max-width: 1600px; /* Increased from 1400px for wider tables */
    margin: 0 auto;
}

/* ========================================
   CARD COMPONENTS
   ======================================== */

.form-box,
.stats-box,
.table-box,
.dashboard-box {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    transition: all var(--transition-normal);
}

.form-box:hover,
.stats-box:hover,
.table-box:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-2xl);
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--text-white);
    padding: var(--spacing-xl);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.stat-card h4 {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: var(--spacing-sm);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.stat-card i {
    font-size: 2.5rem;
    opacity: 0.2;
    position: absolute;
    top: 1rem;
    right: 1rem;
}

/* ========================================
   FORM COMPONENTS
   ======================================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-xl);
}

.form-column {
    display: flex;
    flex-direction: column;
}

label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    font-size: 0.9rem;
}

.form-help {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 0.25rem;
    font-style: italic;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    margin-bottom: var(--spacing-lg);
    transition: all var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

/* ========================================
   BUTTON COMPONENTS
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--text-white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary-color) 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    border-color: var(--secondary-color);
}

.btn-success {
    background: var(--success-color);
    color: var(--text-white);
}

.btn-warning {
    background: var(--warning-color);
    color: var(--text-white);
}

.btn-danger {
    background: var(--error-color);
    color: var(--text-white);
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%);
    color: var(--text-white);
    border: none;
}

.btn-info:hover {
    background: linear-gradient(135deg, #138496 0%, #1c7c64 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-sm {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.8rem;
}

.btn-lg {
    padding: var(--spacing-lg) var(--spacing-xl);
    font-size: 1.1rem;
}

/* Legacy button support */
input[type="submit"],
button {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--text-white);
    box-shadow: var(--shadow-md);
}

input[type="submit"]:hover,
button:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary-color) 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

/* ========================================
   TABLE COMPONENTS
   ======================================== */

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: var(--spacing-xl);
    /* Ensure full width usage */
    width: 100%;
}

table {
    width: 100%;
    min-width: 800px; /* Minimum width to prevent cramping */
    border-collapse: collapse;
    background: var(--bg-card);
    font-size: 0.9rem;
    table-layout: fixed; /* Helps with consistent column sizing */
}

thead {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--border-light) 100%);
}

th {
    padding: var(--spacing-lg) var(--spacing-md); /* More horizontal padding */
    text-align: left;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap; /* Prevent header text wrapping */
    overflow: hidden;
    text-overflow: ellipsis;
}

td {
    padding: var(--spacing-lg) var(--spacing-md); /* More horizontal padding */
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    word-wrap: break-word; /* Allow long text to wrap */
    max-width: 0; /* Allow text overflow to work */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Specific column width adjustments for common table layouts */
.table-container table th:first-child,
.table-container table td:first-child {
    width: 20%;
    min-width: 150px;
}

.table-container table th:last-child,
.table-container table td:last-child {
    width: 20%;
    min-width: 140px;
    text-align: center;
}

/* For tables with many columns, make middle columns flexible */
.table-container table th:not(:first-child):not(:last-child),
.table-container table td:not(:first-child):not(:last-child) {
    width: auto;
    min-width: 120px;
}

tbody tr {
    transition: all var(--transition-fast);
}

tbody tr:hover {
    background-color: var(--bg-tertiary);
    transform: scale(1.002); /* Reduced scale for less jarring effect */
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Table Actions */
.table-actions {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.table-actions a,
.table-actions button {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8rem;
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    white-space: nowrap; /* Prevent button text wrapping */
}

/* Responsive table improvements */
@media (max-width: 1200px) {
    .table-container {
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 1000px; /* Ensure minimum width on smaller screens */
    }
}

@media (max-width: 768px) {
    .table-container {
        margin: 0 -1rem; /* Extend to screen edges on mobile */
        border-radius: 0;
    }
    
    table {
        min-width: 800px;
        font-size: 0.85rem;
    }
    
    th, td {
        padding: var(--spacing-md) var(--spacing-sm);
    }
}

.action-view { color: var(--info-color); }
.action-edit { color: var(--warning-color); }
.action-delete { color: var(--error-color); }
.action-success { color: var(--success-color); }

/* ========================================
   MODAL COMPONENTS
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.8); /* Darker, less transparent */
    backdrop-filter: blur(4px); /* Frosted glass effect */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000; /* Higher z-index */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--bg-card);
    padding: var(--spacing-xl);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 550px;
    border: 1px solid var(--border-color);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Text Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-danger { color: var(--error-color); }

/* Spacing Utilities */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mt-4 { margin-top: var(--spacing-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }

/* Layout Utilities */
.flex { display: flex; }
.grid { display: grid; }
.hidden { display: none !important; }

.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }

/* Status Indicators */
.status-badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-active { background: rgba(16, 185, 129, 0.1); color: var(--success-color); }
.status-pending { background: rgba(245, 158, 11, 0.1); color: var(--warning-color); }
.status-inactive { background: rgba(239, 68, 68, 0.1); color: var(--error-color); }

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .main-content {
        margin-left: 240px;
        padding: var(--spacing-xl);
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: var(--spacing-lg);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid #374151;
    }
    
    .main-content {
        margin-left: 0;
        padding: var(--spacing-lg);
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        font-size: 0.8rem;
    }
    
    .modal-content {
        padding: var(--spacing-lg);
        width: 95%;
    }
}

/* ========================================
   DARK MODE SUPPORT (Optional)
   ======================================== */

@media (prefers-color-scheme: dark) {
    .dark-mode {
        --bg-primary: #1e293b;
        --bg-secondary: #0f172a;
        --bg-tertiary: #334155;
        --bg-card: #1e293b;
        --text-primary: #f8fafc;
        --text-secondary: #cbd5e1;
        --border-color: #374151;
        --border-light: #475569;
    }
}

/* Category tags */
.category-tag {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* ========================================
   TICKET REPLY SECTIONS
   ======================================== */
.ticket-reply-cell {
    background: linear-gradient(135deg, #1e2533 0%, #161b26 100%);
    padding: 18px 20px !important;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
    border-left: 3px solid var(--primary-color);
}

.ticket-reply-title {
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.7rem;
}

.ticket-reply-body {
    margin-bottom: 8px;
    white-space: pre-wrap;
}

.ticket-reply-meta {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ticket-reply-form-cell {
    background: #121923;
    padding: 18px 20px !important;
    border-left: 3px dashed var(--primary-color);
}

.ticket-reply-form textarea {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 100%;
    padding: 10px;
    border-radius: var(--radius-md);
    resize: vertical;
}

.reply-form-actions {
    text-align: right;
    margin-top: 10px;
}

.tickets-table button {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    font-size: 0.7rem;
    border-radius: var(--radius-sm);
}

.tickets-table button:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* ========================================
   ENHANCED TABLE STYLES FOR SPECIFIC PAGES
   ======================================== */

/* Client Table Enhancements */
.clients-table-container {
    min-width: 100%;
}

.clients-table th:nth-child(1) { width: 15%; min-width: 140px; } /* Domain */
.clients-table th:nth-child(2) { width: 15%; min-width: 130px; } /* Client */
.clients-table th:nth-child(3) { width: 12%; min-width: 120px; } /* Email */
.clients-table th:nth-child(4) { width: 12%; min-width: 110px; } /* Hosting */
.clients-table th:nth-child(5) { width: 10%; min-width: 100px; } /* Billing */
.clients-table th:nth-child(6) { width: 10%; min-width: 100px; } /* Price */
.clients-table th:nth-child(7) { width: 10%; min-width: 100px; } /* Status */
.clients-table th:nth-child(8) { width: 16%; min-width: 150px; } /* Actions */

/* Projects Table Enhancements */
.projects-table th:nth-child(1) { width: 20%; min-width: 160px; } /* Project Name */
.projects-table th:nth-child(2) { width: 15%; min-width: 130px; } /* Client */
.projects-table th:nth-child(3) { width: 12%; min-width: 100px; } /* Status */
.projects-table th:nth-child(4) { width: 12%; min-width: 100px; } /* Price */
.projects-table th:nth-child(5) { width: 12%; min-width: 100px; } /* Start Date */
.projects-table th:nth-child(6) { width: 12%; min-width: 100px; } /* End Date */
.projects-table th:nth-child(7) { width: 17%; min-width: 140px; } /* Actions */

/* Support Tickets Table Enhancements */
.tickets-table th:nth-child(1) { width: 15%; min-width: 120px; } /* Title */
.tickets-table th:nth-child(2) { width: 15%; min-width: 120px; } /* Client */
.tickets-table th:nth-child(3) { width: 20%; min-width: 150px; } /* Reason */
.tickets-table th:nth-child(4) { width: 12%; min-width: 100px; } /* Status */
.tickets-table th:nth-child(5) { width: 12%; min-width: 100px; } /* Created */
.tickets-table th:nth-child(6) { width: 16%; min-width: 130px; } /* Actions */

/* Proposals Table Enhancements */
.items-table th:nth-child(1) { width: 25%; min-width: 180px; } /* Title */
.items-table th:nth-child(2) { width: 35%; min-width: 200px; } /* Description */
.items-table th:nth-child(3) { width: 12%; min-width: 100px; } /* Price */
.items-table th:nth-child(4) { width: 13%; min-width: 110px; } /* Category */
.items-table th:nth-child(5) { width: 15%; min-width: 120px; } /* Actions */

.proposals-table th:nth-child(1) { width: 30%; min-width: 180px; } /* Customer */
.proposals-table th:nth-child(2) { width: 25%; min-width: 150px; } /* Date */
.proposals-table th:nth-child(3) { width: 20%; min-width: 120px; } /* Amount */
.proposals-table th:nth-child(4) { width: 25%; min-width: 150px; } /* Actions */

/* Text overflow handling for long content */
.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.text-wrap {
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.4;
}

/* Full-width containers for specific pages */
.full-width-table {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
}

/* Better responsive behavior for action buttons */
@media (max-width: 1024px) {
    .table-actions {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .table-actions a,
    .table-actions button {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        width: 100%;
        text-align: center;
    }
}

/* ========================================
   MOBILE-FIRST RESPONSIVE DESIGN
   ======================================== */

/* Mobile Navigation */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        position: fixed;
        height: 100vh;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .mobile-nav-toggle {
        display: block;
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 1001;
        background: var(--primary-color);
        color: white;
        border: none;
        padding: 0.5rem;
        border-radius: 6px;
        font-size: 1.2rem;
        cursor: pointer;
    }
    
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    
    .mobile-overlay.active {
        display: block;
    }
    
    .main-content {
        padding: 4rem var(--spacing-md) var(--spacing-lg);
        margin-left: 0;
        width: 100%;
    }
    
    .page-container {
        max-width: none;
        padding: 0;
    }
}

/* ========================================
   CARD-ONLY LAYOUTS (NO TABLES)
   ======================================== */

/* Hide all tables - use cards only */
.table-container {
    display: none !important;
}

/* Enhanced card layouts for all devices */
.cards-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
    width: 100%;
}

/* Desktop improvements for cards-container - 4 column grid */
@media (min-width: 769px) {
    .cards-container {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-lg);
    }
}

/* Large desktop - 4 cards per row */
@media (min-width: 1200px) {
    .cards-container {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--spacing-xl);
    }
}

/* Extra large screens - maintain 4 columns */
@media (min-width: 1600px) {
    .cards-container {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--spacing-lg);
    }
}

/* Base card styles - enhanced for all screen sizes */
.mobile-card {
    background: white;
    border-radius: 12px;
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.mobile-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Remove margin-bottom when in grid layout */
@media (min-width: 769px) {
    .cards-container .mobile-card {
        margin-bottom: 0;
    }
}

.mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
}

.mobile-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
    flex: 1;
    margin-right: var(--spacing-sm);
}

.mobile-card-status {
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.mobile-card-body {
    margin-bottom: var(--spacing-md);
}

.mobile-card-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.mobile-card-field:last-child {
    border-bottom: none;
}

.mobile-card-label {
    font-weight: 500;
    color: var(--text-light);
    font-size: 0.9rem;
    min-width: 80px;
}

.mobile-card-value {
    text-align: right;
    flex: 1;
    margin-left: var(--spacing-sm);
    word-break: break-word;
}

.mobile-card-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.mobile-card-actions .btn {
    flex: 1;
    min-width: calc(50% - var(--spacing-xs));
    text-align: center;
    font-size: 0.8rem;
    padding: var(--spacing-sm) var(--spacing-md);
}

.mobile-card-actions .btn:only-child {
    flex: none;
    min-width: 120px;
}

/* Status-specific styles */
.status-active { background: #e8f5e8; color: #2d5a3d; }
.status-inactive { background: #fef2f2; color: #7f1d1d; }
.status-pending { background: #fffbeb; color: #92400e; }
.status-completed { background: #ecfdf5; color: #065f46; }
.status-in-progress { background: #eff6ff; color: #1d4ed8; }
.status-overdue { background: #fef2f2; color: #dc2626; }

/* Client-specific card styles */
.client-card .mobile-card-title {
    color: var(--primary-color);
}

.client-card .mobile-card-field.hosting-type .mobile-card-value {
    font-weight: 500;
    color: var(--primary-color);
}

.client-card .mobile-card-field.price .mobile-card-value {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--success-color);
}

/* Project-specific card styles */
.project-card .mobile-card-header {
    flex-direction: column;
    align-items: stretch;
}

.project-card .mobile-card-title {
    margin-bottom: var(--spacing-xs);
}

.project-card .project-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Ticket-specific card styles */
.ticket-card .mobile-card-header {
    align-items: center;
}

.ticket-card .priority-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: var(--spacing-sm);
}

.priority-high { background: #ef4444; }
.priority-medium { background: #f59e0b; }
.priority-low { background: #10b981; }

/* Proposal-specific card styles */
.proposal-card .mobile-card-field.amount .mobile-card-value {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary-color);
}

.proposal-card .mobile-card-field.items-count .mobile-card-value {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Enhanced mobile forms */
@media (max-width: 768px) {
    .form-group {
        margin-bottom: var(--spacing-lg);
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-row .form-group {
        margin-right: 0;
    }
    
    .btn-group {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .btn-group .btn {
        width: 100%;
    }
    
    .modal-content {
        margin: var(--spacing-md);
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
}

/* Mobile search and filters */
@media (max-width: 768px) {
    .search-container {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .search-input {
        width: 100%;
    }
    
    .filter-buttons {
        flex-wrap: wrap;
        gap: var(--spacing-xs);
    }
    
    .filter-buttons .btn {
        flex: 1;
        min-width: calc(50% - var(--spacing-xs));
        font-size: 0.8rem;
        padding: var(--spacing-sm);
    }
}

/* Mobile-friendly pagination */
@media (max-width: 768px) {
    .pagination {
        flex-wrap: wrap;
        gap: var(--spacing-xs);
        justify-content: center;
    }
    
    .pagination .btn {
        min-width: 40px;
        padding: var(--spacing-sm);
    }
    
    .pagination .btn-text {
        display: none;
    }
    
    .pagination .btn-icon {
        display: inline;
    }
}

/* Touch-friendly interactive elements */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .form-control {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .sidebar a {
        padding: var(--spacing-lg) var(--spacing-xl);
        font-size: 1rem;
    }
    
    .dropdown-menu {
        position: static;
        display: none;
        box-shadow: none;
        border: none;
        background: rgba(255, 255, 255, 0.1);
        margin-left: var(--spacing-lg);
    }
    
    .dropdown:hover .dropdown-menu {
        display: block;
    }
}

/* Improved accessibility for mobile */
@media (max-width: 768px) {
    /* Larger focus indicators */
    button:focus,
    input:focus,
    select:focus,
    textarea:focus,
    a:focus {
        outline: 3px solid var(--primary-color);
        outline-offset: 2px;
    }
    
    /* Better contrast for small text */
    .text-small,
    .mobile-card-label {
        font-size: 0.9rem;
        color: #374151;
    }
}

/* ========================================
   MOBILE NAVIGATION JAVASCRIPT STYLES
   ======================================== */

.mobile-nav-toggle {
    display: none;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.mobile-nav-toggle:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.mobile-nav-toggle:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: block;
    }
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 1400px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 2rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .modal-header, .modal-body {
        padding: 1rem;
    }
}
