/* Mobile-First Admin Styles for Production Tracker */
/* ========================================================================= */

/* RESET & BASE STYLES */
/* ========================================================================= */
* {
    box-sizing: border-box;
}

.production-tracker-admin {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.5;
    color: #333;
    background: #f8f9fa;
    min-height: 100vh;
}

.production-tracker-admin * {
    box-sizing: border-box;
}

/* CONTAINER & LAYOUT */
/* ========================================================================= */
.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px;
    width: 100%;
}

.production-header {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 2px solid #e1e1e1;
}

.production-header h1 {
    color: #23282d;
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.view-switcher {
    display: flex;
    gap: 4px;
    background: #f1f1f1;
    border-radius: 6px;
    padding: 4px;
}

/* BULK ACTIONS - NEW */
/* ========================================================================= */
.bulk-actions {
    display: none;
    background: #e3f2fd;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #2196f3;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.bulk-actions.show {
    display: flex;
}

.bulk-actions-info {
    flex: 1;
    font-weight: 500;
    color: #1976d2;
    min-width: 150px;
}

.bulk-actions-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.bulk-actions-controls select {
    min-width: 180px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

/* CHECKBOX COLUMN */
/* ========================================================================= */
.checkbox-column {
    width: 40px;
    text-align: center;
}

.checkbox-column input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.data-table tbody tr.selected {
    background: #e3f2fd !important;
}

/* STATS GRID - MOBILE FIRST */
/* ========================================================================= */
.stats-grid, .dashboard-cards .stat-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.dashboard-card {
    background: white;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}

.dashboard-card h3 {
    margin: 0 0 15px 0;
    color: #1d2327;
    font-size: 18px;
    font-weight: 600;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    text-align: center;
    border-left: 4px solid #667eea;
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    margin: 0;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 8px 0 0 0;
    font-weight: 600;
}

/* CONTROLS & FILTERS - MOBILE FIRST */
/* ========================================================================= */
.admin-controls {
    background: white;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.controls-row {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.controls-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.controls-section h4 {
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    color: #495057;
    font-weight: 600;
}

/* BUTTONS - MOBILE OPTIMIZED */
/* ========================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    min-height: 44px; /* Touch-friendly height */
    gap: 8px;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-secondary {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.btn-secondary.active {
    background: #2271b1;
    color: white;
    border-color: #2271b1;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-small, .btn-sm {
    padding: 8px 16px;
    font-size: 12px;
    min-height: 36px;
}

.btn-block {
    width: 100%;
    margin-bottom: 10px;
}

/* FORM CONTROLS - MOBILE OPTIMIZED */
/* ========================================================================= */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-control, .filter-select, .search-box input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    min-height: 44px;
    box-sizing: border-box;
}

.form-control:focus, .filter-select:focus, .search-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #6c757d;
    font-size: 12px;
}

.search-input {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input input {
    padding-left: 40px;
}

.search-input::before {
    content: "🔍";
    position: absolute;
    left: 12px;
    z-index: 2;
    font-size: 16px;
}

/* VIEW TOGGLE - MOBILE FRIENDLY */
/* ========================================================================= */
.view-toggle {
    display: flex;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.toggle-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    min-height: 44px;
    font-size: 14px;
}

.toggle-btn.active {
    background: #667eea;
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* DATA TABLES & CONTAINERS */
/* ========================================================================= */
.data-table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.table-header {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
}

.table-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.table-filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f8f9fa;
    padding: 15px 10px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #e9ecef;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.data-table th:hover {
    background: #e9ecef;
}

.data-table th.sorted-asc::after {
    content: " ↑";
    color: #667eea;
}

.data-table th.sorted-desc::after {
    content: " ↓";
    color: #667eea;
}

.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #f1f1f1;
    font-size: 14px;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

/* STATUS & PRIORITY BADGES */
/* ========================================================================= */
.status-badge,
.priority-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.status-pending { background: #fff3cd; color: #856404; }
.status-in-progress, .status-progress { background: #cce5ff; color: #004085; }
.status-completed { background: #d4edda; color: #155724; }
.status-on-hold, .status-hold { background: #f8d7da; color: #721c24; }
.status-cancelled { background: #e2e3e5; color: #383d41; }

.priority-low { background: #e8f5e8; color: #155724; }
.priority-medium { background: #fff3cd; color: #856404; }
.priority-high { background: #f8d7da; color: #721c24; }
.priority-urgent { background: #dc3545; color: white; }

/* KANBAN VIEW */
/* ========================================================================= */
.projects-main-container {
    display: flex;
    flex-direction: column;
    min-height: 600px;
}

.projects-grid-view, .projects-kanban-view {
    display: none;
}

.projects-grid-view.active {
    display: block;
}

.projects-kanban-view.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.projects-kanban-container {
    background: white;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.04);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    flex: 1;
    min-height: 0;
}

.kanban-column {
    background: #f6f7f7;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
    flex-shrink: 0;
}

.column-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #495057;
    text-transform: uppercase;
}

.task-count {
    background: #2271b1;
    color: white;
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 12px;
}

.kanban-cards {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding-right: 5px;
    margin-right: -5px;
}

.kanban-cards::-webkit-scrollbar {
    width: 4px;
}

.kanban-cards::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.kanban-cards::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.kanban-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    cursor: move;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.kanban-card.dragging {
    opacity: 0.7;
    transform: rotate(5deg);
}

.kanban-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.kanban-card-title {
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.kanban-card-priority {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 12px;
    text-transform: uppercase;
    font-weight: 700;
}

.kanban-card-client {
    margin-bottom: 8px;
    font-size: 13px;
    color: #666;
}

.kanban-card-description {
    font-size: 12px;
    color: #777;
    margin-bottom: 10px;
    line-height: 1.4;
}

.kanban-card-dates {
    font-size: 11px;
    color: #888;
    margin-bottom: 10px;
}

.kanban-card-progress {
    margin-bottom: 10px;
}

.progress-label {
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
}

.kanban-progress-bar {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.kanban-progress-fill {
    height: 100%;
    background: #28a745;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-hours {
    font-size: 10px;
    color: #666;
}

.kanban-card-budget {
    font-size: 12px;
    color: #333;
    margin-bottom: 10px;
}

.kanban-card-actions {
    display: flex;
    gap: 5px;
}

/* MODAL - FIXED AND IMPROVED */
/* ========================================================================= */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex !important;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
    margin: 20px;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 25px 30px 20px 30px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
}

.modal-title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: #495057;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #adb5bd;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #e9ecef;
    color: #495057;
}

.modal-body {
    padding: 30px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 30px 30px 30px;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

/* FORM LAYOUT IN MODALS - FIXED */
/* ========================================================================= */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* Single column for textareas */
.form-group:has(textarea) {
    grid-column: 1 / -1;
}

.form-row.two-col {
    grid-template-columns: 1fr 1fr;
}

/* NOTIFICATIONS */
/* ========================================================================= */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    animation: slideInFromRight 0.3s ease;
    max-width: 350px;
}

.notification.success {
    background: #28a745;
}

.notification.error {
    background: #dc3545;
}

.notification.warning {
    background: #ffc107;
    color: #212529;
}

.notification.info {
    background: #17a2b8;
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* LOADING STATES */
/* ========================================================================= */
.loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* TABLET STYLES */
/* ========================================================================= */
@media screen and (min-width: 768px) {
    .admin-container {
        padding: 20px;
    }
    
    .production-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .controls-row {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-end;
    }
    
    .controls-section {
        flex-direction: row;
        align-items: center;
    }

    .table-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .table-filters {
        flex-direction: row;
    }
    
    .btn-block {
        width: auto;
    }
    
    .bulk-actions {
        flex-wrap: nowrap;
    }
    
    .bulk-actions-controls {
        flex-wrap: nowrap;
    }
    
    .modal-content {
        margin: 5% auto;
        width: 90%;
    }
    
    .modal-body {
        padding: 30px;
    }
    
    .modal-header,
    .modal-footer {
        padding: 25px 30px;
    }
    
    .kanban-column {
        flex: 0 0 300px;
    }
}

/* DESKTOP STYLES */
/* ========================================================================= */
@media screen and (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .kanban-column {
        flex: 1;
        max-width: 320px;
    }
    
    .modal-content {
        width: 70%;
    }
    
    .notification {
        max-width: 400px;
    }
}

/* RESPONSIVE MOBILE FIXES */
/* ========================================================================= */
@media screen and (max-width: 480px) {
    .bulk-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .bulk-actions-controls {
        justify-content: center;
    }
    
    .bulk-actions-controls select {
        min-width: 100%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
        max-height: 95vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px;
    }
    
    .modal-footer {
        flex-direction: column;
        align-items: stretch;
    }
}