/* Teddy Medical Billing - Minimalistic Design */

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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-900: #111827;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--gray-900);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    font-size: 48px;
}

.logo h1 {
    font-size: 42px;
    font-weight: 700;
}

.subtitle {
    font-size: 16px;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    padding: 40px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--gray-50);
    padding: 24px;
    border-radius: 12px;
    text-align: center;
    border: 2px solid var(--gray-200);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--gray-200);
    overflow-x: auto;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--gray-600);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

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

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

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

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

/* Forms */
.form-section {
    background: var(--gray-50);
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.form-section h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--gray-900);
}

.form-section h3 {
    font-size: 18px;
    margin: 24px 0 16px;
    color: var(--gray-700);
}

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

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

label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.input-field {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s;
    background: white;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Checkboxes */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.checkbox-label:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

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

/* Buttons */
.btn {
    padding: 12px 32px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
}

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

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

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
    margin-top: 12px;
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-remove {
    background: var(--danger);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Position Row */
.position-row {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 12px;
    margin-bottom: 12px;
}

.position-code, .position-qty {
    margin-bottom: 0 !important;
}

/* Results */
.result-section {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 30px;
    margin-top: 20px;
}

.result-section.empty {
    display: none;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--gray-200);
}

.result-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
}

.result-total {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.result-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.result-item {
    background: var(--gray-50);
    padding: 16px;
    border-radius: 8px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
}

.item-code {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--primary);
    font-size: 14px;
}

.item-description {
    color: var(--gray-700);
}

.item-price {
    font-weight: 600;
    font-size: 18px;
    color: var(--gray-900);
    text-align: right;
}

.search-result-item {
    padding: 20px;
    border-bottom: 1px solid var(--gray-200);
    transition: background 0.2s;
}

.search-result-item:hover {
    background: var(--gray-50);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-code {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--primary);
    font-size: 16px;
    margin-bottom: 8px;
}

.search-desc {
    color: var(--gray-700);
    margin-bottom: 8px;
}

.search-values {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: var(--gray-600);
}

.invoice-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid var(--gray-200);
}

.invoice-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.info-block h4 {
    font-size: 14px;
    text-transform: uppercase;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.info-block p {
    color: var(--gray-900);
    line-height: 1.6;
}

.invoice-summary {
    background: var(--gray-50);
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 16px;
}

.summary-row.total {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px solid var(--gray-300);
}

/* Footer */
.footer {
    background: var(--gray-900);
    color: white;
    padding: 30px;
    text-align: center;
}

.footer-small {
    font-size: 13px;
    opacity: 0.7;
    margin-top: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        border-radius: 0;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .result-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .position-row {
        grid-template-columns: 1fr;
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray-600);
}

.loading::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Error State */
.error {
    background: #fee;
    color: var(--danger);
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid var(--danger);
}

/* Success State */
.success {
    background: #efe;
    color: var(--success);
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid var(--success);
}
