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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* Auth Pages */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-container {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
    font-size: 28px;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    color: white;
}

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
    margin-right: 5px;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 600;
}

.alert.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.error {
    color: #e74c3c;
    margin-bottom: 15px;
    font-weight: 600;
}

.success {
    color: #27ae60;
    margin-bottom: 15px;
    font-weight: 600;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 30px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-header h2 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: #a0a0a0;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 4px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    color: white;
    background: rgba(102, 126, 234, 0.1);
    border-left-color: #667eea;
}

.nav-link .icon {
    margin-right: 12px;
    font-size: 20px;
}

/* Main Content */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 0;
    background: #f5f7fa;
    min-height: 100vh;
}

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

.header h1 {
    color: #2c3e50;
    font-size: 28px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    font-weight: 600;
    color: #555;
}

.content {
    padding: 0 30px 30px;
}

/* Dashboard Cards */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
}

.card h3 {
    color: #555;
    font-size: 16px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card .number {
    font-size: 36px;
    font-weight: 700;
    color: #667eea;
}

.welcome-section {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    text-align: center;
}

.welcome-section h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 28px;
}

.welcome-section p {
    color: #666;
    font-size: 16px;
}

/* Data Tables */
.data-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

.data-section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.data-table tr:hover {
    background: #f8f9fa;
}

/* Status Badges */
.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

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

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

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

.status-badge.paused {
    background: #e2e3e5;
    color: #383d41;
}

.status-badge.completed {
    background: #cce5ff;
    color: #004085;
}

/* Form Sections */
.form-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

.form-section h2 {
    margin-bottom: 25px;
    color: #2c3e50;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.form-actions .btn {
    width: auto;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state p {
    color: #666;
    margin-bottom: 20px;
    font-size: 18px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .cards {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        font-size: 14px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px;
    }
}

/* OCR Specific Styles */

.drop-zone {
    border: 3px dashed #ccc;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
    margin-top: 20px;
}

.drop-zone:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.drop-zone.drag-over {
    border-color: #667eea;
    background: #e8edff;
    transform: scale(1.02);
}

.drop-zone-content {
    pointer-events: none;
}

.drop-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.drop-text {
    font-size: 18px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.drop-subtext {
    font-size: 14px;
    color: #888;
}

/* OCR Status Box */
.ocr-status {
    margin-top: 20px;
}

.status-box {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    text-align: center;
}

.status-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.status-box p {
    color: #555;
    font-weight: 600;
    margin-bottom: 15px;
}

.ocr-progress-bar {
    width: 100%;
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 15px;
}

.ocr-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    transition: width 0.3s ease;
    width: 0%;
}

.ocr-steps {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.ocr-steps .step {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #999;
    background: #f0f0f0;
    transition: all 0.3s;
}

.ocr-steps .step.active {
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Preview Section */
.preview-section {
    margin-top: 20px;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.preview-section h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.image-preview {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

/* Raw Text Display */
.raw-text-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 300px;
    overflow-y: auto;
}

/* Label Badge */
.label-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
    background: #f0f4ff;
    border: 1px solid #d0d8ff;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    margin-bottom: 0;
}

.table-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.table-actions .btn {
    width: auto;
    padding: 8px 16px;
    font-size: 14px;
}

.table-wrapper {
    overflow-x: auto;
}

.data-table th:first-child,
.data-table td:first-child {
    width: 50px;
    text-align: center;
}

.data-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.empty-cell {
    text-align: center;
    color: #888;
    padding: 40px;
}

#alert-container {
    position: sticky;
    top: 20px;
    z-index: 100;
}

#alert-container .alert {
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .table-actions {
        width: 100%;
    }
    
    .table-actions .btn {
        flex: 1;
    }
    
    .drop-zone {
        padding: 40px 15px;
    }
    
    .drop-text {
        font-size: 16px;
    }
    
    .ocr-steps {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .ocr-steps .step {
        padding: 4px 10px;
        font-size: 11px;
    }
}

/* Auth Links */
.auth-container p {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

.auth-container a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.auth-container a:hover {
    text-decoration: underline;
}

/* ===== ORDER SUMMARY CARDS ===== */
.order-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.order-card h3 {
    color: #667eea;
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f4ff;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: #888;
    font-size: 13px;
    font-weight: 600;
}

.info-value {
    color: #333;
    font-weight: 700;
    text-align: right;
    max-width: 60%;
}

/* ===== SERIAL DATA CARDS ===== */
.serial-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    margin-bottom: 25px;
    overflow: hidden;
}

.serial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex-wrap: wrap;
    gap: 10px;
}

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

.serial-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.serial-badge {
    background: white;
    color: #667eea;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
}

.serial-date {
    font-size: 13px;
    opacity: 0.9;
}

.serial-order {
    font-size: 13px;
}

.serial-count {
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
}

.serial-items {
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
}

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

.serial-actions .btn-small {
    padding: 5px 10px;
    font-size: 12px;
    margin: 0;
}

.serial-preview {
    padding: 20px 25px;
    background: #f8f9fa;
}

.preview-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #e8e8e8;
    font-size: 14px;
}

.preview-row:last-child {
    border-bottom: none;
}

.preview-label {
    color: #667eea;
    font-weight: 600;
    min-width: 140px;
    flex-shrink: 0;
}

.preview-value {
    color: #555;
}

.preview-more {
    text-align: center;
    padding: 10px;
    color: #888;
    font-size: 13px;
}

.serial-detail {
    padding: 20px 25px;
    border-top: 1px solid #e0e0e0;
}

/* ===== CATEGORY BADGES ===== */
.cat-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.cat-order {
    background: #e3f2fd;
    color: #1565c0;
}

.cat-customer {
    background: #f3e5f5;
    color: #7b1fa2;
}

.cat-items {
    background: #e8f5e9;
    color: #2e7d32;
}

.cat-general {
    background: #fff3e0;
    color: #ef6c00;
}

/* ===== FILTER FORM ===== */
.filter-form .form-row {
    grid-template-columns: 2fr 1fr auto;
    align-items: end;
}

.results-info {
    margin-bottom: 20px;
    color: #666;
    font-size: 14px;
}

/* ===== RESPONSIVE IMPROVEMENTS ===== */
@media (max-width: 992px) {
    .filter-form .form-row {
        grid-template-columns: 1fr 1fr;
    }
    
    .serial-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .serial-left, .serial-right {
        width: 100%;
    }
    
    .serial-right {
        justify-content: flex-start;
    }
    
    .info-value {
        max-width: 50%;
    }
}

@media (max-width: 768px) {
    .filter-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .serial-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .preview-label {
        min-width: 100px;
    }
    
    .info-row {
        flex-direction: column;
        gap: 4px;
    }
    
    .info-value {
        max-width: 100%;
        text-align: left;
    }
}
