/**
 * Service Confirmation Module - Styles
 * Module 10
 */

/* ========================================
   Variables & Reset
   ======================================== */
:root {
    --primary-blue: #001f54;
    --primary-red: #a30000;
    --success-green: #28a745;
    --warning-yellow: #ffc107;
    --danger-red: #dc3545;
    --text-dark: #333;
    --text-muted: #666;
    --border-color: #e0e0e0;
    --bg-light: #f8f9fa;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f5f5;
    color: var(--text-dark);
    min-height: 100vh;
}

/* ========================================
   Header
   ======================================== */
.main-header {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-red));
    color: white;
    padding: 15px 25px;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1800px;
    margin: 0 auto;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-section h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.logo-section i {
    font-size: 1.8rem;
}

.home-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.home-btn:hover {
    background: rgba(255,255,255,0.3);
}

.user-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ========================================
   Main Layout - 3 Columns
   ======================================== */
.container {
    display: grid;
    grid-template-columns: 350px 1fr 380px;
    gap: 20px;
    padding: 20px;
    max-width: 1800px;
    margin: 0 auto;
    min-height: calc(100vh - 80px);
}

@media (max-width: 1400px) {
    .container {
        grid-template-columns: 300px 1fr 320px;
    }
}

@media (max-width: 1100px) {
    .container {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Panels
   ======================================== */
.pending-panel,
.detail-panel,
.history-panel {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    background: var(--bg-light);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-header h2 i {
    color: var(--primary-blue);
}

.panel-filters {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.search-input,
.filter-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0,31,84,0.1);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

/* ========================================
   Service Cards
   ======================================== */
.service-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
}

.service-card:hover {
    border-color: var(--primary-blue);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.service-card.selected {
    border-color: var(--primary-blue);
    border-width: 2px;
    background: rgba(0,31,84,0.02);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-blue), #003080);
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nomenclature {
    font-weight: 600;
    font-size: 0.95rem;
}

.work-date {
    font-size: 0.85rem;
    opacity: 0.9;
}

.card-body {
    padding: 12px 15px;
}

.company-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.client-info {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.service-info {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.badge-info {
    background: #e3f2fd;
    color: #1565c0;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.price {
    font-weight: 600;
    color: var(--success-green);
}

.card-actions {
    padding: 10px 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.btn-action {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-complete {
    background: #e8f5e9;
    color: var(--success-green);
}

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

.btn-not-complete {
    background: #ffebee;
    color: var(--danger-red);
}

.btn-not-complete:hover {
    background: var(--danger-red);
    color: white;
}

/* ========================================
   Detail Panel
   ======================================== */
.detail-view {
    padding: 5px;
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.current-status {
    font-size: 1.2rem;
    font-weight: 700;
    padding: 8px 20px;
    border-radius: 20px;
}

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

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

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

.nomenclature-badge {
    background: var(--primary-blue);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
}

.quick-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.quick-actions .btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

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

.btn-success:hover {
    background: #218838;
}

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

.btn-danger:hover {
    background: #c82333;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.detail-section {
    margin-bottom: 25px;
}

.detail-section h3 {
    color: var(--primary-blue);
    font-size: 1rem;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-blue);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-item.full-width {
    grid-column: span 2;
}

.detail-item label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-item span {
    font-weight: 500;
    color: var(--text-dark);
}

.observations-content {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 8px;
    white-space: pre-wrap;
    color: var(--text-muted);
}

/* ========================================
   History Panel
   ======================================== */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.stat-item {
    text-align: center;
    padding: 8px;
    border-radius: 8px;
    background: var(--bg-light);
}

.stat-item i {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.stat-completed i { color: var(--success-green); }
.stat-not-completed i { color: var(--danger-red); }
.stat-pending i { color: var(--warning-yellow); }
.stat-invoice i { color: var(--primary-blue); }

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-dark);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    background: var(--bg-light);
    border-color: var(--primary-blue);
}

.history-item.selected {
    border-color: var(--primary-blue);
    background: rgba(0,31,84,0.03);
}

.history-status {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-icon {
    font-size: 1.5rem;
}

.text-success { color: var(--success-green); }
.text-danger { color: var(--danger-red); }
.text-warning { color: var(--warning-yellow); }

.history-info {
    flex: 1;
    min-width: 0;
}

.history-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.history-header .nomenclature {
    font-weight: 600;
    color: var(--text-dark);
}

.status-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }

.history-company {
    font-size: 0.9rem;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    display: flex;
    gap: 15px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.history-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    background: var(--bg-light);
    color: var(--text-muted);
    text-decoration: none;
}

.btn-icon:hover {
    background: var(--primary-blue);
    color: white;
}

.btn-pdf:hover {
    background: var(--danger-red);
}

/* ========================================
   Pagination
   ======================================== */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-top: 1px solid var(--border-color);
}

.btn-page {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-page:hover:not(:disabled) {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

.btn-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ========================================
   Empty States & Loading
   ======================================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.95rem;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.loading-spinner i {
    font-size: 2rem;
    margin-bottom: 10px;
}

.error-message {
    text-align: center;
    padding: 20px;
    color: var(--danger-red);
    background: #fff5f5;
    border-radius: 8px;
}

/* ========================================
   Badges
   ======================================== */
.badge {
    background: var(--primary-blue);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ========================================
   Notifications
   ======================================== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-md);
    transform: translateX(120%);
    transition: transform 0.3s ease;
    z-index: 9999;
    max-width: 400px;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    background: var(--success-green);
}

.notification-error {
    background: var(--danger-red);
}

.notification-info {
    background: var(--primary-blue);
}

.notification i {
    font-size: 1.2rem;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1100px) {
    .pending-panel,
    .detail-panel,
    .history-panel {
        max-height: 500px;
    }

    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .quick-actions {
        flex-direction: column;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-item.full-width {
        grid-column: span 1;
    }

    .card-actions {
        flex-direction: column;
    }
}

/* ========================================
   Task Tracking - Progress Bars
   ======================================== */
.card-progress {
    padding: 10px 15px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-light);
}

.progress-mini {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar-mini {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill-mini {
    height: 100%;
    background: #90caf9;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-fill-mini.in-progress {
    background: linear-gradient(90deg, #ffc107, #ffeb3b);
}

.progress-fill-mini.complete {
    background: linear-gradient(90deg, #4caf50, #8bc34a);
}

.progress-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 35px;
}

.card-complete {
    border-color: var(--success-green) !important;
}

.card-complete .card-header {
    background: linear-gradient(135deg, #2e7d32, #43a047);
}

/* ========================================
   Detail Header with Progress
   ======================================== */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.progress-indicator {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    min-width: 150px;
}

.progress-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-blue), #1976d2);
    border-radius: 5px;
    transition: width 0.3s ease;
}

/* ========================================
   Task Checklist Styles
   ======================================== */
.task-tracking-section {
    background: linear-gradient(135deg, #f8f9fa, #fff);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.task-tracking-section h3 {
    margin-bottom: 5px;
    border-bottom: none;
    padding-bottom: 0;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.task-checklist {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.task-item:hover {
    border-color: var(--primary-blue);
    background: rgba(0, 31, 84, 0.02);
}

.task-item input[type="checkbox"] {
    display: none;
}

.task-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid #ccc;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.task-checkbox::after {
    content: '';
    width: 12px;
    height: 12px;
    background: transparent;
    border-radius: 3px;
    transition: var(--transition);
}

.task-item input[type="checkbox"]:checked + .task-checkbox {
    background: var(--success-green);
    border-color: var(--success-green);
}

.task-item input[type="checkbox"]:checked + .task-checkbox::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: white;
    font-size: 12px;
    background: transparent;
}

.task-item input[type="checkbox"]:checked ~ .task-label {
    color: var(--success-green);
}

.task-item input[type="checkbox"]:checked ~ .task-label i {
    color: var(--success-green);
}

.task-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: var(--text-dark);
    transition: var(--transition);
}

.task-label i {
    width: 20px;
    text-align: center;
    color: var(--text-muted);
    transition: var(--transition);
}

/* Save Indicator */
.save-indicator {
    margin-top: 15px;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 0.85rem;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.save-indicator.saving {
    opacity: 1;
    background: #fff3cd;
    color: #856404;
}

.save-indicator.saved {
    opacity: 1;
    background: #d4edda;
    color: #155724;
}

.save-indicator.error {
    opacity: 1;
    background: #f8d7da;
    color: #721c24;
}

/* ========================================
   Admin Notes
   ======================================== */
.admin-notes-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    transition: var(--transition);
}

.admin-notes-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 31, 84, 0.1);
}

.admin-notes-input::placeholder {
    color: #aaa;
}

/* Observations readonly */
.observations-content.readonly {
    background: #f8f9fa;
    color: var(--text-muted);
    font-size: 0.9rem;
    border: 1px dashed var(--border-color);
}

/* ========================================
   Compact Detail Grid
   ======================================== */
.detail-grid.compact {
    gap: 10px;
}

.detail-grid.compact .detail-item {
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: 6px;
}

.detail-grid.compact .detail-item label {
    font-size: 0.7rem;
}

.detail-grid.compact .detail-item span {
    font-size: 0.9rem;
}

/* ========================================
   History Badge Styles
   ======================================== */
.badge-secondary {
    background: #e9ecef;
    color: #6c757d;
}

.text-muted {
    color: #adb5bd !important;
}
