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

:root {
    --primary: #3b82f6;
    --primary-dark: #1e40af;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --background: #f9fafb;
    --surface: #ffffff;
    --border: #e5e7eb;
    --text: #1f2937;
    --text-light: #6b7280;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
}

.header-content h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.header-content p {
    font-size: 0.95rem;
    opacity: 0.9;
}

.btn-logout {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

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

/* Main Content */
.main {
    flex: 1;
    padding: 2rem;
}

/* Tabs Navigation */
.tabs-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
}

.tab-btn {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-header {
    margin-bottom: 2rem;
}

.tab-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.tab-header p {
    color: var(--text-light);
}

/* Upload Section */
.upload-section {
    margin-bottom: 2rem;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

/* Preview Section */
.preview-section {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.preview-section h3,
.preview-section h4 {
    margin-bottom: 1.5rem;
    color: var(--text);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    font-family: 'Courier New', monospace;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background-color: var(--surface);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-secondary:hover {
    background-color: #f0f9ff;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* List Section */
.list-section {
    margin-top: 2rem;
}

.list-section h3 {
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.items-list {
    display: grid;
    gap: 1rem;
}

.item {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.item:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.item-content {
    flex: 1;
}

.item-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.item-info {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    color: var(--text-light);
    font-size: 0.9rem;
}

.item-amount {
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--primary);
}

.item-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
}

/* Machine Details */
.machine-details {
    background-color: #f9fafb;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

.machine-details h5 {
    margin-bottom: 0.5rem;
    color: var(--text);
}

.machine-details ul {
    list-style: none;
    padding-left: 0;
}

.machine-details li {
    padding: 0.25rem 0;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.card.highlight {
    background: linear-gradient(135deg, var(--secondary) 0%, #059669 100%);
    color: white;
    border: none;
}

.card-icon {
    font-size: 2.5rem;
}

.card-content {
    flex: 1;
}

.card-label {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.card-value {
    font-size: 1.8rem;
    font-weight: 700;
}

/* Sections */
.section {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.section h3 {
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.subsection {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.subsection:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.subsection h4 {
    margin-bottom: 1rem;
    color: var(--text);
}

/* Export Section */
.export-section {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.export-section h3 {
    margin-bottom: 0.5rem;
}

.export-section p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.export-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    background-color: white;
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.spinner {
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: var(--text);
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .header-content h1 {
        font-size: 1.5rem;
    }

    .main {
        padding: 1rem;
    }

    .tabs-nav {
        flex-direction: column;
        border-bottom: none;
        border-left: 3px solid var(--border);
    }

    .tab-btn {
        border-bottom: none;
        border-left: 3px solid transparent;
        text-align: left;
        padding: 0.75rem 1rem;
    }

    .tab-btn.active {
        border-left-color: var(--primary);
        border-bottom: none;
    }

    .item {
        flex-direction: column;
        align-items: flex-start;
    }

    .item-actions {
        margin-left: 0;
        margin-top: 1rem;
        width: 100%;
    }

    .summary-cards {
        grid-template-columns: 1fr;
    }

    .export-buttons {
        flex-direction: column;
    }

    .export-buttons button {
        width: 100%;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.item {
    animation: slideIn 0.3s ease;
}

/* Utility Classes */
.text-success {
    color: var(--secondary);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* Image Preview */
.image-preview {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.image-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

/* Header Date */
.header-date {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Filter Section */
.filter-section {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.filter-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.filter-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filter-controls .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.button-group .btn-secondary {
    flex: 1;
    min-width: 120px;
}

.filter-info {
    background-color: #f0f9ff;
    border-left: 4px solid #3b82f6;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    color: #1e40af;
}

@media (max-width: 768px) {
    .filter-controls .form-row {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .button-group .btn-secondary {
        width: 100%;
    }
}

/* Settings Section */
.settings-section {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.settings-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.settings-section select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
    background-color: white;
    color: var(--text);
    cursor: pointer;
}

.settings-section select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
