/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Login Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.company-logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
    padding: 5px;
}

.company-logo img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: contain;
    background-color: transparent;
    padding: 2px;
    border: 2px solid #667eea;
}

.logo-fallback {
    display: none !important; /* Hide by default */
}

img[src*="tras_logo"]:not([src=""]):not(:errors) + .logo-fallback {
    display: none !important; /* Ensure fallback stays hidden when image loads */
}

/* Only show fallback when image fails to load */
img[src*="tras_logo"][src=""], 
img[src*="tras_logo"]:errors {
    display: none;
}

img[src*="tras_logo"][src=""] + .logo-fallback,
img[src*="tras_logo"]:errors + .logo-fallback {
    display: flex !important;
}

.company-name {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
    line-height: 1.3;
}

.company-tagline {
    font-size: 14px;
    color: #666;
    margin-bottom: 30px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

input, select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input:focus, select:focus {
    outline: none;
    border-color: #667eea;
}

button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

button:hover {
    transform: translateY(-2px);
}

.error {
    color: #dc3545;
    text-align: center;
    margin-top: 10px;
    font-size: 14px;
}

/* Main Application Styles */
.main-app {
    display: none;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.header {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 1rem;
    padding: 3px;
}

.header-logo img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: contain;
    background-color: transparent;
    padding: 2px;
    border: 2px solid #667eea;
}

.header-logo .logo-fallback {
    display: none;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    border: none;
}

.header-text {
    display: flex;
    flex-direction: column;
}

.header-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    line-height: 1.2;
}

.header-subtitle {
    font-size: 14px;
    color: #666;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 20px;
    align-items: center;
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: 2px solid #667eea;
    color: #667eea;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    width: auto;
    font-size: 14px;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

.logout-btn {
    background: #dc3545;
    border: 2px solid #dc3545;
    color: white;
    width: auto;
    padding: 8px 20px;
    font-size: 14px;
}

.logout-btn:hover {
    background: #c82333;
    border-color: #c82333;
}

/* Tab Content */
.tab-content {
    display: none;
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.tab-content.active {
    display: block;
}

.tab-content h2 {
    margin-bottom: 30px;
    color: #333;
    font-size: 28px;
}

/* Form Layout */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.order-id-section {
    display: flex;
    gap: 10px;
    align-items: end;
}

.order-id-section button {
    height: 48px;
    width: auto;
    padding: 0 20px;
    background: #28a745;
    margin-bottom: 0;
    font-size: 14px;
}

.order-id-section button:hover {
    background: #218838;
}

/* Receipt Styles */
.receipt {
    max-width: 600px;
    margin: 30px auto;
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    border: 2px solid #e1e5e9;
}

.receipt-header {
    text-align: center;
    border-bottom: 3px solid #667eea;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.receipt-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 15px;
    padding: 4px;
}

.receipt-logo img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: contain;
    background-color: transparent;
    padding: 2px;
    border: 2px solid #667eea;
}

.receipt-logo .logo-fallback {
    display: none;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.receipt-company-name {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    line-height: 1.3;
}

.receipt-tagline {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}

.receipt-title {
    color: #667eea;
    font-size: 18px;
    font-weight: bold;
}

.receipt-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.detail-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.detail-label {
    font-weight: bold;
    color: #666;
    font-size: 14px;
    margin-bottom: 5px;
}

.detail-value {
    font-size: 18px;
    color: #333;
    font-weight: 600;
}

.total-section {
    text-align: center;
    padding: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    margin: 30px 0;
}

.total-section p {
    margin-bottom: 10px;
    font-size: 16px;
}

.total-amount {
    font-size: 32px;
    font-weight: bold;
}

.thank-you {
    text-align: center;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 15px;
    border: 2px dashed #667eea;
    margin-top: 30px;
}

.thank-you h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 20px;
}

.thank-you p {
    line-height: 1.5;
    color: #666;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.print-btn {
    background: #28a745;
    width: auto;
    padding: 12px 30px;
    font-size: 14px;
}

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

.download-btn {
    background: #17a2b8;
    width: auto;
    padding: 12px 30px;
    font-size: 14px;
}

.download-btn:hover {
    background: #138496;
}

/* Schedule Styles */
.schedule-heading {
    margin-top: 40px;
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
}

.schedules-container {
    max-height: 600px;
    overflow-y: auto;
}

.schedule-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 15px;
    border-left: 5px solid #667eea;
    transition: all 0.3s;
}

.schedule-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

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

.client-id {
    background: #667eea;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
}

.phase-badge {
    background: #28a745;
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
}

.schedule-item h4 {
    color: #333;
    margin-bottom: 10px;
    font-size: 18px;
}

.schedule-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    color: #666;
    margin-bottom: 15px;
}

.schedule-details div {
    font-size: 14px;
}

.remove-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s;
}

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

.empty-schedule {
    text-align: center;
    color: #666;
    padding: 40px;
    font-style: italic;
}

/* Employee Payment Styles */
.payment-records {
    margin-top: 2rem;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.records-actions {
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.print-records-btn,
.download-records-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.print-records-btn {
    background: #28a745;
    color: white;
}

.download-records-btn {
    background: #667eea;
    color: white;
}

.payment-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 15px;
}

/* Company Selection Styles - Updated */
.company-select-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 20px;
}

.company-select-container h2 {
    color: #333;
    margin-bottom: 40px;
    font-size: 28px;
    text-align: center;
}

.company-options {
    display: flex;
    gap: 40px;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 1200px;
}

.company-option {
    background: white;
    border-radius: 20px;
    padding: 30px;
    width: 300px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.company-option:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

.company-option .company-logo {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    position: relative;
    border-radius: 50%;
    background: white;
    padding: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.company-option .company-logo img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: contain;
    display: block;
}

.company-option .logo-fallback {
    display: none;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #667eea;
    color: white;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

/* Orders List Styles */
.orders-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.order-actions {
    display: flex;
    gap: 15px;
}

.orders-table-container {
    overflow-x: auto;
}

#ordersTable {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#ordersTable th,
#ordersTable td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
}

#ordersTable th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

#ordersTable tr:hover {
    background: #f8f9fa;
}

.completed {
    background: #f0fff4;
}

#orderSearch {
    padding: 8px 12px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    width: 200px;
}

#addOrderBtn,
#exportOrdersBtn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

#addOrderBtn {
    background: #667eea;
    color: white;
}

#exportOrdersBtn {
    background: #28a745;
    color: white;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 24px;
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.modal-actions button {
    width: auto;
    padding: 10px 20px;
}

.modal-actions button[type="button"] {
    background: #dc3545;
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    
    .payment-records,
    .payment-records * {
        visibility: visible;
    }
    
    .payment-records {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white;
    }
    
    .records-actions,
    .payment-actions {
        display: none !important;
    }
    
    .payment-list {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .payment-card {
        page-break-inside: avoid;
        break-inside: avoid;
    }
}

/* Logo Styles - Updated */
.company-logo img,
.header-logo img,
.receipt-logo img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: contain;
    background-color: transparent;
    padding: 2px;
    border: 2px solid #667eea;
}

/* Logo Containers - Updated */
.company-logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
    padding: 5px;
}

.header-logo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 1rem;
    padding: 3px;
}

.receipt-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 15px;
    padding: 4px;
}

/* Logo Fallback - Updated */
.logo-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

/* Container Styles */
.company-logo,
.header-logo,
.receipt-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

.header-logo {
    margin-right: 1rem;
}

/* Specific adjustments for receipt logo */
.receipt-logo img {
    width: 60px;
    height: 60px;
}

.receipt-logo .logo-fallback {
    width: 60px;
    height: 60px;
    font-size: 1.2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .nav-tabs {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .receipt-details {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .schedule-details {
        grid-template-columns: 1fr;
    }
    
    .order-id-section {
        flex-direction: column;
    }
    
    .order-id-section button {
        width: 100%;
        margin-top: 10px;
    }
}

/* Order Status Styles */
.import-btn {
    background: #6c757d;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-block;
}

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

#saveStatusBtn {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
}

.status-select {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Status Colors */
tr.active { background-color: #fff; }
tr.in-progress { background-color: #fff3cd; }
tr.under-review { background-color: #cce5ff; }
tr.revision { background-color: #f8d7da; }
tr.completed { background-color: #d4edda; }
tr.delivered { background-color: #d1ecf1; }
tr.cancelled { background-color: #f5f5f5; }

#bulkStatus {
    margin-left: 8px;
    padding: 2px 4px;
    font-size: 12px;
}

/* Print Styles */
@media print {
    .action-buttons, 
    .tab-content > *:not(.receipt),
    .header,
    .tab-content h2,
    .tab-content form {
        display: none !important;
    }
    
    .receipt {
        box-shadow: none;
        margin: 0;
        max-width: none;
        border: none;
    }
    
    body {
        background: white;
    }
    
    .main-app {
        padding: 0;
        max-width: none;
    }
    
    .tab-content {
        box-shadow: none;
        padding: 0;
        margin: 0;
    }
}