/* /public_html/css/style.css - Fully Consolidated Stylesheet */

/* === Global Styles & Variables === */
:root {
    --primary-color: #0066cc;
    --secondary-color: #004c99;
    --background-color: #f4f7f6;
    --surface-color: #ffffff;
    --text-color: #333;
    --light-text-color: #fff;
    --border-color: #e0e0e0;
    --nav-link-color: #444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin-top: 70px; /* Offset for the fixed navbar */
}

main {
    flex-grow: 1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* === Anchor Link Scrolling Fix === */
section[id] {
    scroll-margin-top: 70px;
}

.section-header {
    text-align: center;
    margin-bottom: 2rem;
}

/* === Navigation Bar === */
.navbar {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 0.8rem 0;
    transition: box-shadow 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    text-decoration: none;
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    gap: 1.8rem;
}

.nav-link {
    text-decoration: none;
    color: var(--nav-link-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-color);
}

.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.btn-primary {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #004085;
}

.btn-secondary {
    color: #6c757d;
    background-color: transparent;
    border-color: #6c757d;
}

.btn-secondary:hover {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

/* === Form & Alert Styles === */
.form-container {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    max-width: 500px;
    margin: 2rem auto;
}

.form-container h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

.alert {
    position: relative;
    padding: 12px 20px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeaa7;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* === Mobile Navigation === */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1010;
}

.mobile-menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-color);
    margin: 4px 0;
    transition: all 0.3s ease-in-out;
}

/* === Footer === */
footer {
    text-align: center;
    margin-top: 3rem;
    padding: 1.5rem;
    color: #777;
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
}

/* === Testimonials Section === */
.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.testimonial-card {
    background: var(--surface-color);
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.testimonial-rating {
    color: var(--accent-color);
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.testimonial-text {
    color: #555;
    font-style: italic;
    flex-grow: 1;
    margin-bottom: 1.5rem;
}

.testimonial-author {
    font-weight: bold;
    color: var(--primary-color);
    text-align: right;
}

/* === Dashboard Styles === */
.dashboard-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    align-items: start;
}

.dashboard-sidebar {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.dashboard-sidebar h4 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.dashboard-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dashboard-sidebar ul li a {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--nav-link-color);
    border-radius: 5px;
    margin-bottom: 0.5rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.dashboard-sidebar ul li a:hover,
.dashboard-sidebar ul li a.active {
    background-color: var(--primary-color);
    color: var(--light-text-color);
}

.dashboard-content {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.dashboard-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.summary-card {
    background: #f9f9f9;
    padding: 1.5rem;
    border-radius: 5px;
    border: 1px solid var(--border-color);
}

.summary-card h3 {
    font-size: 1rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.summary-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* === Tables === */
.orders-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2rem;
}

.orders-table th, .orders-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.orders-table th {
    background-color: #f9f9f9;
}

/* === Status Badges === */
.status-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: capitalize;
}

.status-pending { background-color: #fef3c7; color: #92400e; }
.status-approved { background-color: #d1fae5; color: #065f46; }
.status-completed { background-color: #dbeafe; color: #1e40af; }
.status-cancelled { background-color: #fee2e2; color: #991b1b; }

/* === Service Cards === */
.service-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    border: 1px solid #e0e0e0;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.service-card .card-title {
    font-weight: 600;
}

.service-card .card-price {
    font-weight: 700;
    color: #2c3e50;
}

/* === Enhanced Dashboard & Cards === */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1.5rem;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.dashboard-card h3 {
    margin-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.75rem;
}

.dashboard-card .card-actions {
    margin-top: auto;
}

/* === Forms === */
.form-card {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.form-card .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
}

.form-card .card-body {
    padding: 1.5rem;
}

.form-check-label strong {
    display: block;
    margin-bottom: 0.25rem;
}

/* === Responsive Table === */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* === Device Parts List === */
.part-item {
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.part-info {
    flex-grow: 1;
}

.part-actions {
    flex-shrink: 0;
}

/* === Session Timeout Modal === */
#session-warning-modal .modal-content {
    border: 2px solid #ffc107;
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.3);
}

#session-warning-modal .modal-header {
    border-bottom: 1px solid #ffc107;
}

#session-warning-modal .modal-header h5 {
    color: #856404;
    font-weight: bold;
}

#session-countdown {
    font-family: 'Courier New', monospace;
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    margin: 20px 0;
}

/* === Session Notifications === */
.session-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.modal-backdrop.session-timeout-backdrop {
    background-color: rgba(255, 193, 7, 0.5);
}

.activity-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 12px;
    height: 12px;
    background-color: #28a745;
    border-radius: 50%;
    z-index: 1000;
    opacity: 0.7;
    transition: background-color 0.3s ease;
}

.activity-indicator.warning {
    background-color: #ffc107;
}

.activity-indicator.danger {
    background-color: #dc3545;
}

/* === Modal Fallback === */
.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0,0,0,0.5);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 10px;
    max-width: 500px;
}

.modal-content {
    position: relative;
    background-color: #fff;
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 8px;
    box-shadow: 0 3px 9px rgba(0,0,0,0.5);
    padding: 0;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #dee2e6;
    background-color: #ffc107;
    border-radius: 8px 8px 0 0;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
}

.modal-body {
    position: relative;
    padding: 20px;
    text-align: center;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* === Custom Repair Form === */
.device-card {
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
}

.device-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.device-card.selected {
    border-color: #0d6efd;
    background-color: #f8f9fa;
}

.work-order-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-left: 4px solid #28a745;
    position: relative;
}

.work-order-item.unique {
    border-left-color: #fd7e14;
}

.work-order-item.batch {
    border-left-color: #20c997;
}

.scanner-input {
    position: relative;
}

.scanner-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-controls input {
    width: 80px;
    text-align: center;
}

.scanning-indicator {
    display: none;
    color: #28a745;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.device-type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.75rem;
}

.pricing-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 0.8rem;
}

.work-order-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    padding: 1.5rem;
    position: sticky;
    top: 20px;
}

.auto-fill-indicator {
    color: #28a745;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.auto-fill-indicator.show {
    opacity: 1;
}

.cost-input {
    max-width: 120px;
}

.problem-description-area {
    min-height: 80px;
    resize: vertical;
}

.order-total-section {
    border-top: 2px solid rgba(255,255,255,0.3);
    margin-top: 1rem;
    padding-top: 1rem;
}

.price-warning {
    color: #ffc107;
    font-size: 0.8rem;
}

.draft-indicator {
    background: #ffc107;
    color: #000;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.device-problem-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

/* === ADMIN SECTION === */
/* Admin-specific styles with proper namespacing */
.admin-page {
    background-color: #f4f7f6;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    flex-shrink: 0;
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 20px;
    transition: width 0.3s ease;
}

.admin-sidebar .sidebar-title {
    text-align: center;
    margin-bottom: 30px;
    font-weight: 300;
    font-size: 1.5rem;
}

.admin-sidebar .sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-sidebar .sidebar-nav li a {
    display: block;
    padding: 12px 15px;
    color: #ecf0f1;
    text-decoration: none;
    border-radius: 5px;
    margin-bottom: 5px;
    transition: background-color 0.2s ease-in-out;
}

.admin-sidebar .sidebar-nav li a:hover,
.admin-sidebar .sidebar-nav li a.active {
    background-color: #34495e;
}

.admin-main-content {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
}

/* Admin Dashboard Stats Grid */
.admin-page .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 25px;
}

.admin-page .stat-card {
    background-color: #ffffff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.admin-page .stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.admin-page .stat-icon {
    font-size: 2rem;
    color: #3498db;
    margin-right: 20px;
    width: 50px;
    text-align: center;
}

.admin-page .stat-info p {
    margin: 0;
    color: #7f8c8d;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-page .stat-info h3 {
    margin: 0;
    font-size: 2.2rem;
    font-weight: 600;
    color: #2c3e50;
}

/* === Work Order Specific Styles === */
.work-order-container {
    display: grid;
    grid-template-columns: 1fr 440px;
    gap: 2rem;
    align-items: flex-start;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.step-header .step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f8f9fc;
    border: 1px solid var(--border-color);
    font-weight: 700;
    color: #4e73df;
    transition: background-color 0.3s, color 0.3s;
}

.step-header.active .step-number {
    background-color: #4e73df;
    color: #fff;
}

#device-list-container {
    max-height: 500px;
    overflow-y: auto;
}

.config-panel {
    display: none;
    animation: fadeIn 0.5s;
}

.config-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.order-summary-sticky {
    position: sticky;
    top: 20px;
}

.order-cart-item {
    border: 1px solid var(--border-color);
}

.order-cart-item .cost-edit-input {
    max-width: 100px;
}

#order-cart-items:empty + #order-empty {
    display: flex;
}

#order-empty {
    display: none;
}

.order-totals {
    border-top: 2px solid var(--border-color);
}

.is-invalid {
    border-color: #dc3545 !important;
}

.toast-container {
    z-index: 1090;
}

#scannerModal .modal-body {
    min-height: 300px;
}

#scanner-container {
    width: 100%;
}

#scanner-container video {
    width: 100%;
}

/* === Responsive Adjustments === */
@media (max-width: 992px) {
    .work-order-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-wrapper {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
        height: auto;
        min-height: 0;
    }
    
    .admin-main-content {
        padding: 20px;
    }
}

@media (max-width: 576px) {
    .session-notification {
        left: 10px;
        right: 10px;
        width: auto;
        min-width: auto;
    }
    
    .modal-dialog {
        margin: 10px;
        max-width: none;
    }
    
    #session-countdown {
        font-size: 2rem;
    }
}