/**
 * Trade Business Toolkit v7 - Complete Styles
 */

/* Reset & Base */
.awtk-app {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 900px;
    margin: 0 auto;
    padding: 16px;
    color: #1F2937;
    line-height: 1.6;
    background: #F9FAFB;
    min-height: 100vh;
}

.awtk-app *, .awtk-app *::before, .awtk-app *::after { box-sizing: border-box; }

/* Header */
.awtk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.awtk-logo { font-size: 20px; font-weight: 800; color: #059669; }

.awtk-premium-badge {
    background: linear-gradient(135deg, #F59E0B, #FBBF24);
    color: #78350F;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
}

/* Navigation */
.awtk-nav {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}

.awtk-nav-btn {
    padding: 10px 16px;
    background: #fff;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #6B7280;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.awtk-nav-btn:hover { border-color: #059669; color: #059669; }
.awtk-nav-btn.active { background: #059669; border-color: #059669; color: #fff; }
.awtk-nav-premium { background: linear-gradient(135deg, #FEF3C7, #FDE68A); border-color: #F59E0B; color: #92400E; }

/* Cards & Tabs */
.awtk-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.awtk-card h2 { margin: 0 0 4px; font-size: 24px; color: #1F2937; }
.awtk-subtitle { color: #6B7280; margin: 0 0 20px; }
.awtk-tab { display: none; }
.awtk-tab.active { display: block; }

/* Forms */
.awtk-form { display: flex; flex-direction: column; gap: 8px; }

.awtk-section {
    background: #F9FAFB;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 8px;
}

.awtk-section h3 { margin: 0 0 12px; font-size: 16px; color: #374151; }
.awtk-section h4 { margin: 16px 0 8px; font-size: 14px; color: #6B7280; }

.awtk-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    align-items: end;
}

.awtk-field { display: flex; flex-direction: column; gap: 4px; }
.awtk-field label { font-size: 13px; font-weight: 500; color: #374151; }

.awtk-field input, .awtk-field select, .awtk-field textarea, .awtk-input {
    padding: 10px 12px;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: #1F2937;
    transition: border-color 0.2s;
}

.awtk-field input:focus, .awtk-field select:focus, .awtk-field textarea:focus, .awtk-input:focus {
    outline: none;
    border-color: #059669;
}

.awtk-field textarea { resize: vertical; min-height: 60px; }
.awtk-field-small { max-width: 140px; }

.awtk-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
}

.awtk-checkbox input { width: 18px; height: 18px; cursor: pointer; }

/* Buttons */
.awtk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.awtk-btn-primary {
    background: linear-gradient(135deg, #059669, #10B981);
    color: #fff;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.awtk-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(5, 150, 105, 0.4);
}

.awtk-btn-secondary { background: #F3F4F6; color: #374151; }
.awtk-btn-secondary:hover { background: #E5E7EB; }
.awtk-btn-danger { background: #FEE2E2; color: #DC2626; }
.awtk-btn-danger:hover { background: #FECACA; }
.awtk-btn-premium { background: linear-gradient(135deg, #F59E0B, #FBBF24); color: #78350F; }
.awtk-btn-full { width: 100%; }
.awtk-btn .btn-loading { display: none; }
.awtk-btn.loading .btn-text { display: none; }
.awtk-btn.loading .btn-loading { display: inline; }
.awtk-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* Line Items */
.awtk-items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.awtk-item { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.awtk-item-desc { flex: 2; min-width: 150px; padding: 10px 12px; border: 2px solid #E5E7EB; border-radius: 8px; font-size: 15px; }
.awtk-item-qty { width: 70px; padding: 10px; border: 2px solid #E5E7EB; border-radius: 8px; font-size: 15px; text-align: center; }
.awtk-item-price { width: 100px; padding: 10px; border: 2px solid #E5E7EB; border-radius: 8px; font-size: 15px; text-align: right; }
.awtk-item-remove { width: 40px; height: 40px; background: #FEE2E2; color: #DC2626; border: none; border-radius: 8px; font-size: 18px; cursor: pointer; flex-shrink: 0; }
.awtk-item-remove:hover { background: #FECACA; }

/* Client Picker */
.awtk-client-picker { position: relative; margin-bottom: 12px; }
.awtk-client-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 2px solid #E5E7EB;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.awtk-client-list.show { display: block; }
.awtk-client-item { padding: 12px; cursor: pointer; border-bottom: 1px solid #F3F4F6; }
.awtk-client-item:hover { background: #F0FDF4; }
.awtk-client-item strong { color: #1F2937; }
.awtk-client-item small { color: #6B7280; display: block; margin-top: 2px; }
.awtk-client-empty { padding: 16px; text-align: center; color: #9CA3AF; }

/* Usage Banner */
.awtk-usage {
    background: #F0FDF4;
    border: 2px solid #BBF7D0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.awtk-usage.warning { background: #FFFBEB; border-color: #FDE68A; }
.awtk-usage.critical { background: #FEF2F2; border-color: #FECACA; }
.awtk-usage.premium { background: linear-gradient(135deg, #FEF3C7, #FDE68A); border-color: #F59E0B; }
.awtk-usage-text { font-size: 14px; color: #374151; }
.awtk-usage-text strong { color: #059669; }
.awtk-usage.warning .awtk-usage-text strong { color: #D97706; }
.awtk-usage.critical .awtk-usage-text strong { color: #DC2626; }
.awtk-usage-link { color: #059669; font-weight: 600; text-decoration: none; }
.awtk-usage-link:hover { text-decoration: underline; }

/* Alerts */
.awtk-alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-weight: 500;
}

.awtk-alert-success { background: #D1FAE5; color: #065F46; }
.awtk-alert-error { background: #FEE2E2; color: #991B1B; }
.awtk-alert-warning { background: #FEF3C7; color: #92400E; }

/* Output Area */
.awtk-output {
    margin-top: 24px;
    background: #fff;
    border: 2px solid #10B981;
    border-radius: 16px;
    overflow: hidden;
}

.awtk-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #F0FDF4;
    border-bottom: 1px solid #BBF7D0;
    flex-wrap: wrap;
    gap: 12px;
}

.awtk-output-header h3 { margin: 0; font-size: 16px; color: #065F46; }
.awtk-output-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.awtk-output-content {
    padding: 24px;
    max-height: 600px;
    overflow-y: auto;
    background: #fff;
    color: #1F2937;
}

.awtk-output-content * { color: #1F2937 !important; background-color: transparent !important; max-width: 100% !important; }
.awtk-output-content > div { background: #fff !important; }
.awtk-output-content table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.awtk-output-content th, .awtk-output-content td { padding: 10px; border: 1px solid #E5E7EB; text-align: left; }
.awtk-output-content th { background: #F8FAFC !important; font-weight: 600; }

.awtk-doc-number {
    background: #F0FDF4;
    border: 2px solid #BBF7D0;
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 16px;
    font-family: monospace;
    font-size: 14px;
}

.awtk-doc-number strong { color: #059669; }

/* Logo Upload */
.awtk-logo-area { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }

.awtk-logo-preview {
    width: 120px;
    height: 80px;
    border: 2px dashed #D1D5DB;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F9FAFB;
    overflow: hidden;
}

.awtk-logo-preview.has-logo { border-style: solid; border-color: #10B981; }
.awtk-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.awtk-logo-placeholder { text-align: center; color: #9CA3AF; font-size: 12px; line-height: 1.4; }
.awtk-logo-actions { display: flex; flex-direction: column; gap: 8px; }
.awtk-logo-actions small { color: #9CA3AF; font-size: 12px; }

/* Saved Clients */
.awtk-clients-list { border: 1px solid #E5E7EB; border-radius: 8px; max-height: 300px; overflow-y: auto; }
.awtk-saved-client { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid #F3F4F6; }
.awtk-saved-client:last-child { border-bottom: none; }
.awtk-saved-client-info strong { color: #1F2937; display: block; }
.awtk-saved-client-info small { color: #6B7280; }
.awtk-loading { padding: 20px; text-align: center; color: #9CA3AF; }

/* Calculator */
.awtk-calc-grid { display: grid; gap: 16px; }
.awtk-calc-box { background: #F9FAFB; border-radius: 12px; padding: 16px; }
.awtk-calc-box h3 { margin: 0 0 12px; font-size: 16px; }
.awtk-calc-result { margin-top: 12px; padding: 16px; background: #fff; border: 2px solid #10B981; border-radius: 8px; text-align: center; font-size: 20px; font-weight: 700; color: #059669; }
.awtk-calc-result small { display: block; font-size: 14px; font-weight: 400; color: #6B7280; margin-top: 4px; }

/* Premium Tab */
.awtk-premium-card { text-align: center; }
.awtk-premium-hero { padding: 24px 0; }
.awtk-premium-hero h2 { font-size: 28px; margin: 0 0 8px; }
.awtk-premium-price { font-size: 48px; font-weight: 800; color: #059669; margin: 0; }
.awtk-premium-price span { font-size: 18px; font-weight: 400; color: #6B7280; }

.awtk-premium-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 24px 0;
    text-align: left;
}

.awtk-feature { padding: 12px 16px; background: #F0FDF4; border-radius: 8px; color: #065F46; font-weight: 500; }

.awtk-checkout { max-width: 400px; margin: 0 auto; text-align: left; }

.awtk-plan-options { display: flex; flex-direction: column; gap: 8px; }
.awtk-plan-option { display: flex; align-items: center; gap: 10px; padding: 12px; background: #F9FAFB; border-radius: 8px; cursor: pointer; }
.awtk-plan-option:hover { background: #F0FDF4; }
.awtk-plan-option input { width: 18px; height: 18px; }
.awtk-plan-info { text-align: center; color: #6B7280; font-size: 14px; margin: 0 0 16px; }

.awtk-divider { margin: 24px 0; color: #9CA3AF; font-size: 14px; }
.awtk-license-form { max-width: 400px; margin: 0 auto; }
.awtk-license-form p { margin: 0 0 12px; color: #6B7280; }
.awtk-license-form .awtk-row { margin-bottom: 12px; }
.awtk-license-form input { width: 100%; padding: 10px 12px; border: 2px solid #E5E7EB; border-radius: 8px; font-size: 14px; }

/* Footer */
.awtk-footer { text-align: center; margin-top: 32px; padding: 16px 0; color: #9CA3AF; font-size: 13px; }
.awtk-footer a { color: #059669; text-decoration: none; }

/* Responsive */
@media (max-width: 640px) {
    .awtk-app { padding: 12px; }
    .awtk-card { padding: 16px; }
    .awtk-card h2 { font-size: 20px; }
    .awtk-row { grid-template-columns: 1fr; }
    .awtk-item { flex-direction: column; align-items: stretch; }
    .awtk-item-desc, .awtk-item-qty, .awtk-item-price { width: 100%; }
    .awtk-item-remove { width: 100%; height: 36px; }
    .awtk-logo-area { flex-direction: column; text-align: center; }
    .awtk-output-header { flex-direction: column; align-items: stretch; }
    .awtk-output-actions { justify-content: center; }
    .awtk-premium-price { font-size: 36px; }
}

/* Print */
@media print {
    .awtk-header, .awtk-nav, .awtk-output-header, .awtk-output-actions, .awtk-footer, .awtk-form, .awtk-section { display: none !important; }
    .awtk-output { border: none; margin: 0; }
    .awtk-output-content { max-height: none; padding: 0; }
}
