/* ==========================================================================
   ELITE TEAR SHEET GENERATOR CSS
   Glassmorphism, Print-ready Paper View, SVG Charting
   ========================================================================== */

/* Layout & Globals */
.ts-container { margin-left: 20px; padding: 32px; min-height: 100vh; color: #ffffff; font-family: 'Inter', sans-serif; position: relative; overflow-x: hidden; display: flex; flex-direction: column; }
.ts-layout { display: flex; gap: 32px; align-items: flex-start; flex-grow: 1; }
.ts-config { width: 340px; flex-shrink: 0; position: sticky; top: 32px; max-height: calc(100vh - 100px); overflow-y: auto; padding-right: 8px; }
.ts-config::-webkit-scrollbar { width: 4px; }
.ts-config::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }
.ts-preview-stage { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }

/* Utilities */
.hidden { display: none !important; opacity: 0; pointer-events: none; }
.hidden-mobile { display: flex; }
@media (max-width: 768px) { .hidden-mobile { display: none !important; } .ts-layout { flex-direction: column; } .ts-config { width: 100%; position: relative; top: 0; max-height: none; } }
.m-0 { margin: 0; } .mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-4 { margin-bottom: 4px; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.p-0 { padding: 0 !important; } .p-16 { padding: 16px; } .p-24 { padding: 24px; } .pt-16 { padding-top: 16px; } .pb-16 { padding-bottom: 16px; } .border-bottom { border-bottom: 1px solid rgba(255,255,255,0.1); } .border-top { border-top: 1px solid rgba(255,255,255,0.1); }
.text-xs { font-size: 0.75rem; } .text-sm { font-size: 0.85rem; } .text-muted { color: rgba(255,255,255,0.6); } .w-full { width: 100%; } .text-center { text-align: center; } .text-right { text-align: right; }
.uppercase { text-transform: uppercase; } .letter-spacing { letter-spacing: 1px; } .font-bold { font-weight: 700; } .tabular-nums { font-variant-numeric: tabular-nums; }
.flex-between { display: flex; justify-content: space-between; align-items: center; } .flex-align-center { display: flex; align-items: center; } .gap-8 { gap: 8px; } .gap-16 { gap: 16px; } .flex-grow { flex-grow: 1; min-height: 0; } .flex-shrink-0 { flex-shrink: 0; } .cursor-pointer { cursor: pointer; } .ml-8 { margin-left: 8px; }

/* Palette */
.text-purple { color: #c084fc; } .text-cyan { color: #06b6d4; } .text-gold { color: #fbbf24; } .text-red { color: #ef5350; } .text-green { color: #22c55e; } .text-white { color: #ffffff; }

/* Animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { 0% { transform: scale(0.9); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes pulseGlow { 0% { box-shadow: 0 0 0 0 rgba(6,182,212,0.4); } 70% { box-shadow: 0 0 0 15px rgba(6,182,212,0); } 100% { box-shadow: 0 0 0 0 rgba(6,182,212,0); } }

.fade-in { animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.pulse-btn { animation: pulseGlow 2s infinite; border-radius: 12px; }
.pulse-glow { animation: pulseGlow 2s infinite; border-radius: 8px; }

/* Cards & Buttons */
.ts-card { background: rgba(255,255,255,0.03); backdrop-filter: blur(24px) saturate(180%); border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; box-shadow: 0 8px 32px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05); transition: all 0.4s; }

.ts-btn { padding: 10px 20px; border-radius: 12px; font-weight: 700; font-size: 0.85rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.3s; border: none; text-transform: uppercase; font-family: inherit; }
.ts-btn--primary { background: linear-gradient(135deg, #06b6d4, #a855f7); color: white; box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3); }
.ts-btn--primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5); }
.ts-btn--primary:disabled { opacity: 0.5; cursor: not-allowed; }
.ts-btn--secondary { background: rgba(255,255,255,0.05); color: white; border: 1px solid rgba(255,255,255,0.1); }
.ts-btn--secondary:hover:not(:disabled) { background: rgba(255,255,255,0.1); border-color: #c084fc; color: #c084fc; }
.ts-btn-icon { background: transparent; border: none; color: rgba(255,255,255,0.6); cursor: pointer; transition: 0.2s; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; }
.ts-btn-icon:hover { color: white; background: rgba(255,255,255,0.1); transform: scale(1.05); }
.ts-btn-icon-small { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: white; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; transition: 0.3s; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0; }
.ts-btn-icon-small:hover { background: rgba(192,132,252,0.2); color: #c084fc; border-color: #c084fc; }
.ts-btn-text { background: transparent; border: none; font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: 0.2s; padding: 0; display: inline-flex; align-items: center; gap: 6px; }
.ts-btn-text:hover { filter: brightness(1.2); }

.ts-input, .ts-select { width: 100%; padding: 10px 14px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); color: white; border-radius: 8px; transition: 0.3s; font-family: inherit; font-size: 0.85rem; outline: none; }
.ts-input:focus, .ts-select:focus { border-color: #c084fc; box-shadow: 0 0 0 2px rgba(192,132,252,0.2); }
.ts-form-group { margin-bottom: 16px; }
.ts-form-group label { display: block; margin-bottom: 8px; font-size: 0.8rem; color: rgba(255,255,255,0.8); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.ts-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Switch Toggle */
.ts-switch { position: relative; display: inline-block; width: 36px; height: 18px; flex-shrink: 0; }
.ts-switch input { opacity: 0; width: 0; height: 0; }
.ts-slider-toggle { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.1); transition: .4s; border-radius: 24px; }
.ts-slider-toggle:before { position: absolute; content: ""; height: 14px; width: 14px; left: 2px; bottom: 2px; background-color: white; transition: .4s; border-radius: 50%; }
.ts-switch input:checked + .ts-slider-toggle { background-color: #c084fc; }
.ts-switch input:checked + .ts-slider-toggle:before { transform: translateX(18px); }

/* Checkboxes */
.ts-chk-list { display: flex; flex-direction: column; gap: 12px; }
.ts-chk-row { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 0.85rem; color: rgba(255,255,255,0.8); background: rgba(0,0,0,0.2); padding: 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.05); transition: 0.2s; }
.ts-chk-row:hover { background: rgba(255,255,255,0.05); border-color: rgba(192,132,252,0.3); }
.ts-chk-row input { accent-color: #c084fc; width: 16px; height: 16px; cursor: pointer; }

/* Color Picker & Templates */
.ts-color-picker { -webkit-appearance: none; width: 100%; height: 36px; border: none; border-radius: 8px; cursor: pointer; padding: 0; background: transparent; }
.ts-color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.ts-color-picker::-webkit-color-swatch { border: 1px solid rgba(255,255,255,0.2); border-radius: 8px; }

.ts-template-grid { display: flex; gap: 8px; }
.ts-tpl-card { flex: 1; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); text-align: center; padding: 8px; border-radius: 8px; font-size: 0.75rem; font-weight: 700; cursor: pointer; transition: 0.2s; color: rgba(255,255,255,0.6); }
.ts-tpl-card:hover { color: white; background: rgba(255,255,255,0.05); }
.ts-tpl-card.active { background: rgba(192,132,252,0.2); color: #c084fc; border-color: #c084fc; }

/* Header & Dropdown */
.ts-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 24px; flex-shrink: 0; }
.ts-header__title { font-size: 2.2rem; font-weight: 800; margin: 0 0 8px 0; letter-spacing: 1px; }
.ts-header__subtitle { color: #c084fc; margin: 0; font-size: 1rem; }

.ts-dropdown-wrap { position: relative; }
.ts-dropdown-menu { position: absolute; top: 100%; right: 0; width: 220px; background: #0d0b12; border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; margin-top: 8px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); z-index: 100; padding: 8px; animation: popIn 0.2s ease-out; }
.ts-dd-item { width: 100%; text-align: left; padding: 12px; background: transparent; border: none; color: white; font-weight: 600; font-size: 0.85rem; cursor: pointer; border-radius: 8px; transition: 0.2s; display: flex; align-items: center; gap: 12px; }
.ts-dd-item:hover { background: rgba(255,255,255,0.05); color: #c084fc; }

/* THE PAPER PREVIEW */
.ts-badge { font-size: 0.75rem; padding: 6px 12px; border-radius: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; display: inline-flex; align-items: center; gap: 8px; }

.ts-paper { width: 800px; min-height: 1131px; /* A4 Ratio */ background: #ffffff; color: #1a1a1a; box-shadow: 0 0 40px rgba(0,0,0,0.5); padding: 40px; box-sizing: border-box; position: relative; transition: all 0.3s; --prim-color: #a855f7; --acc-color: #06b6d4; font-family: 'Inter', sans-serif; }

.ts-paper-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 24px; margin-bottom: 24px; }
.p-logo-box { width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 800; color: white; border-radius: 8px; }
.p-title-box { text-align: right; }
.p-title { margin: 0 0 8px 0; font-size: 1.8rem; font-weight: 900; letter-spacing: 2px; color: #000; text-transform: uppercase; }
.p-subtitle { font-size: 0.85rem; color: #666; font-weight: 600; }

.ts-paper-kpi-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 24px; background: #f3f4f6; padding: 16px; border-radius: 8px; }
.p-kpi { display: flex; flex-direction: column; align-items: center; text-align: center; border-right: 1px solid #d1d5db; }
.p-kpi:last-child { border-right: none; }
.p-kpi .lbl { font-size: 0.6rem; text-transform: uppercase; color: #6b7280; font-weight: 700; margin-bottom: 4px; }
.p-kpi .val { font-size: 1.2rem; }

.ts-paper-split { display: flex; gap: 24px; }
.p-section { display: flex; flex-direction: column; }
.p-sec-title { font-size: 0.85rem; font-weight: 800; text-transform: uppercase; border-bottom: 2px solid; padding-bottom: 4px; margin-bottom: 12px; }

.p-chart-box { width: 100%; border: 1px solid #e5e7eb; border-radius: 4px; background: #f9fafb; position: relative; overflow: hidden; }
.paper-svg { width: 100%; height: 100%; overflow: visible; padding: 10px; }
.p-axis { stroke: #d1d5db; stroke-width: 1; }
.p-line-eq { fill: none; stroke: var(--prim-color); stroke-width: 2; stroke-linejoin: round; }
.p-area-dd { fill: #fca5a5; opacity: 0.3; }
.p-bar-up { fill: #22c55e; }
.p-bar-dn { fill: #ef5350; }
.p-pie { stroke: #fff; stroke-width: 1; }

.p-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
.p-table td { padding: 6px 0; border-bottom: 1px solid #f3f4f6; color: #374151; }
.p-table tr:last-child td { border-bottom: none; }

.hm-month-grid { display: grid; grid-template-columns: 40px repeat(12, 1fr) 50px; gap: 2px; font-size: 0.6rem; text-align: center; }
.hm-cell { padding: 4px 2px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.hm-lbl { color: #6b7280; font-weight: 700; }
.hm-yr { font-weight: 800; text-align: left; }
.hm-tot { font-weight: 800; background: #e5e7eb; }

.ts-paper-footer { margin-top: auto; padding-top: 24px; border-top: 1px solid #e5e7eb; display: flex; justify-content: space-between; font-size: 0.7rem; color: #9ca3af; }

/* Modals */
.ts-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.ts-modal__overlay { position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); }
.ts-modal__content { position: relative; background: #0d0b12; border: 1px solid rgba(255,255,255,0.1); border-radius: 24px; width: 90%; max-height: 90vh; overflow-y: auto; padding: 32px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); animation: popIn 0.3s cubic-bezier(0.16,1,0.3,1) forwards; }
.ts-modal__close { position: absolute; top: 24px; right: 24px; background: none; border: none; color: rgba(255,255,255,0.5); font-size: 1.5rem; cursor: pointer; transition: 0.3s; z-index: 10; }
.ts-modal__close:hover { color: white; }

.ts-copy-box { display: flex; gap: 8px; align-items: center; }
.url-input { font-family: monospace; color: #06b6d4; font-weight: 700; font-size: 0.9rem; }

.ts-saved-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; overflow-y: auto; padding-right: 8px; }
.ts-sv-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; padding: 16px; cursor: pointer; transition: 0.2s; }
.ts-sv-card:hover { background: rgba(255,255,255,0.05); border-color: #06b6d4; transform: translateY(-2px); }
.sv-thumb { width: 100%; height: 100px; background: #fff; border-radius: 4px; margin-bottom: 12px; opacity: 0.5; }