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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #e8e8e8;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 20px 0;
    gap: 15px;
}

.header-user-menu {
    position: relative;
    justify-self: start;
}

.header-center {
    text-align: center;
    justify-self: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-self: end;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

.subtitle {
    color: #a0a0a0;
    font-size: 0.95rem;
}

/* User Menu Dropdown */
.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(30, 30, 46, 0.8);
    border: 1px solid #333;
    border-radius: 8px;
    color: #ccc;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.user-menu-btn:hover {
    background: rgba(40, 40, 56, 0.9);
    border-color: #4a9eff;
}

.dropdown-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.user-menu-btn.open .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    background: rgba(30, 30, 46, 0.95);
    border: 1px solid #333;
    border-radius: 8px;
    min-width: 160px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.user-dropdown-item {
    padding: 10px 14px;
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.user-dropdown-item:hover {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
}

/* Auth Styles */
.auth-form-container {
    background: rgba(30, 30, 46, 0.95);
    border-radius: 12px;
    padding: 15px;
    min-width: 280px;
    border: 1px solid #333;
}

.auth-tabs {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 1px solid #333;
}

.auth-tab {
    flex: 1;
    padding: 8px;
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.auth-tab.active {
    color: #4a9eff;
    border-bottom: 2px solid #4a9eff;
}

.auth-tab:hover:not(.active) {
    color: #ccc;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-form .form-group input {
    width: 100%;
    padding: 10px 12px;
    background: #2a2a3e;
    border: 1px solid #444;
    border-radius: 6px;
    color: #fff;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.auth-form .form-group input:focus {
    outline: none;
    border-color: #4a9eff;
}

.auth-form .form-group input::placeholder {
    color: #666;
}

.auth-error {
    color: #ff6b6b;
    font-size: 0.85rem;
    padding: 8px;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 4px;
}

.auth-submit-btn {
    padding: 10px;
    background: linear-gradient(135deg, #4a9eff, #667eea);
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.3);
}

.auth-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(30, 30, 46, 0.8);
    border-radius: 8px;
    border: 1px solid #333;
}

.user-greeting {
    color: #ccc;
    font-size: 0.9rem;
}

.logout-btn {
    padding: 6px 12px;
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #ff6b6b;
    color: white;
}

/* Upload Section */
.upload-section {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}

.upload-box {
    width: 500px;
    height: 300px;
    border: 3px dashed #4a5568;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.03);
}

.upload-box:hover {
    border-color: #48dbfb;
    background: rgba(72, 219, 251, 0.05);
    transform: scale(1.02);
}

.upload-box.dragover {
    border-color: #48dbfb;
    background: rgba(72, 219, 251, 0.1);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.upload-box p {
    color: #a0a0a0;
    font-size: 1.1rem;
}

.upload-hint {
    font-size: 0.85rem !important;
    color: #666 !important;
    margin-top: 10px;
}

/* Main Content */
.main-content {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

/* Stats Panel */
.stats-panel {
    width: 280px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.stats-panel h2 {
    color: #ff6b6b;
    font-size: 1rem;
    letter-spacing: 2px;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-group {
    margin-bottom: 25px;
}

.stat-group label {
    display: block;
    color: #a0a0a0;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.stat-values {
    color: #e8e8e8;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.stat-percent {
    font-size: 1.4rem;
    font-weight: 700;
}

.stat-percent.good {
    color: #2ecc71;
}

.stat-percent.warning {
    color: #feca57;
}

.stat-percent.bad {
    color: #ff6b6b;
}

/* Grade Section */
.grade-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.grade-section h3 {
    font-size: 0.85rem;
    color: #48dbfb;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.grades {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.grade-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.grade-label {
    color: #a0a0a0;
}

.grade-value {
    font-weight: 700;
    color: #2ecc71;
    display: flex;
    align-items: center;
    gap: 8px;
}

.grade-value .grade-name {
    font-size: 0.7rem;
    font-weight: 400;
    color: #a0a0a0;
}

.grade-value.excellent {
    color: #2ecc71;
}

.grade-value.good {
    color: #48dbfb;
}

.grade-value.ok {
    color: #feca57;
}

.grade-value.low {
    color: #ff6b6b;
}

/* Centering Ratio Display */
.centering-ratio-section {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    text-align: center;
}

.centering-ratio-section label {
    display: block;
    color: #a0a0a0;
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.centering-ratio {
    font-size: 2rem;
    font-weight: 700;
    color: #48dbfb;
}

.grade-note {
    font-size: 0.75rem;
    color: #777;
    margin-bottom: 12px;
    line-height: 1.4;
}

/* Standards Section */
.standards-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.standards-section h3 {
    font-size: 0.85rem;
    color: #feca57;
    margin-bottom: 12px;
}

.standards-table {
    font-size: 0.8rem;
}

.standard-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 6px 8px;
    border-radius: 4px;
}

.standard-row.header {
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
    color: #e8e8e8;
    margin-bottom: 4px;
}

.standard-row:not(.header) {
    color: #a0a0a0;
}

.standard-row:not(.header):nth-child(odd) {
    background: rgba(255, 255, 255, 0.02);
}

.standards-note {
    font-size: 0.7rem;
    color: #666;
    margin-top: 10px;
    font-style: italic;
}

/* Legend */
.legend {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #a0a0a0;
}

.legend-color {
    width: 20px;
    height: 4px;
    border-radius: 2px;
}

.legend-color.outer {
    background: #ff6b6b;
}

.legend-color.inner {
    background: #2ecc71;
}

/* Reset Button */
.action-buttons-wrapper {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reset-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.reset-btn:hover {
    background: rgba(255, 107, 107, 0.3);
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#canvas {
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    cursor: crosshair;
    max-width: 100%;
}

.canvas-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.rotate-label {
    color: #666;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nudge-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #4a9eff;
    background: rgba(74, 158, 255, 0.15);
    color: #4a9eff;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

.nudge-btn:hover {
    background: rgba(74, 158, 255, 0.4);
    transform: scale(1.1);
}

.nudge-btn:active {
    transform: scale(0.9);
    background: #4a9eff;
    color: #fff;
}

.canvas-controls input[type="range"] {
    width: 140px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #4a9eff 0%, #2a2a3e 50%, #4a9eff 100%);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.canvas-controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4a9eff;
    border-radius: 50%;
    cursor: grab;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: transform 0.15s;
}

.canvas-controls input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.canvas-controls input[type="range"]::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.canvas-controls input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4a9eff;
    border-radius: 50%;
    cursor: grab;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.rotation-value {
    font-size: 0.8rem;
    color: #4a9eff;
    font-weight: 600;
    font-family: 'Monaco', 'Consolas', monospace;
    min-width: 40px;
}

.instructions {
    margin-top: 15px;
    color: #a0a0a0;
    font-size: 0.95rem;
    text-align: center;
}

.outer-text {
    color: #ff6b6b;
    font-weight: 600;
}

.inner-text {
    color: #2ecc71;
    font-weight: 600;
}

/* AI Analysis Button */
.ai-btn {
    padding: 14px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.ai-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.ai-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.action-buttons .ai-btn {
    flex: 1;
}

/* Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: linear-gradient(180deg, #1e2a3a 0%, #15202b 100%);
    border-radius: 20px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: #888;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #fff;
}

/* Loading State */
.modal-loading {
    padding: 60px 40px;
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.modal-loading p {
    color: #e8e8e8;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.loading-sub {
    color: #888 !important;
    font-size: 0.9rem !important;
}

.loading-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin: 20px auto;
    overflow: hidden;
}

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

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}

.step {
    font-size: 0.85rem;
    color: #555;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.3s;
}

.step.active {
    color: #48dbfb;
    background: rgba(72, 219, 251, 0.1);
}

.step.completed {
    color: #2ecc71;
}

.step.completed::after {
    content: " ✓";
}

/* Modal Content */
.modal-content {
    padding: 30px;
}

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

.analysis-header h2 {
    font-size: 1.5rem;
    color: #fff;
}

.modal-content h3 {
    color: #48dbfb;
    font-size: 1rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Card Identification */
.card-identification {
    margin-bottom: 25px;
}

.card-details {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
}

.card-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.card-detail-row .label {
    color: #888;
}

.card-detail-row .value {
    color: #fff;
    font-weight: 500;
}

/* Card Correction UI */
.card-correction {
    margin-top: 12px;
}

.edit-card-btn {
    background: none;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    color: #888;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    width: 100%;
    transition: all 0.2s;
}

.edit-card-btn:hover {
    border-color: #48dbfb;
    color: #48dbfb;
    background: rgba(72, 219, 251, 0.05);
}

.correction-input {
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 12px;
}

.correction-input input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 0.95rem;
}

.correction-input input:focus {
    outline: none;
    border-color: #48dbfb;
}

.correction-input input::placeholder {
    color: #666;
}

.correction-hint {
    font-size: 0.75rem;
    color: #666;
    margin-top: 6px;
    margin-bottom: 10px;
}

.correction-buttons {
    display: flex;
    gap: 8px;
}

.correction-cancel {
    flex: 1;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #888;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.correction-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
}

.correction-submit {
    flex: 2;
    padding: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
}

.correction-submit:hover {
    opacity: 0.9;
}

/* Market Values */
.market-values {
    margin-bottom: 25px;
}

.values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.value-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}

.value-card .grade {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 5px;
}

.value-card .price {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2ecc71;
}

.value-card .price-range {
    font-size: 0.75rem;
    color: #666;
    margin-top: 3px;
}

.value-card.raw .price {
    color: #feca57;
}

.value-card {
    cursor: pointer;
    transition: all 0.2s;
}

.value-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.value-card.selected {
    border: 2px solid #48dbfb;
}

/* Info Tooltip */
.info-tooltip {
    cursor: help;
    color: #666;
    font-size: 0.8rem;
    margin-left: 5px;
}

.info-tooltip:hover {
    color: #48dbfb;
}

/* Price Sources */
.price-sources {
    margin-top: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.price-sources h4 {
    color: #48dbfb;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.sources-content {
    font-size: 0.85rem;
    color: #a0a0a0;
    line-height: 1.6;
}

.source-item {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.source-item .source-label {
    color: #fff;
    font-weight: 500;
    margin-bottom: 4px;
}

.source-item .source-reasoning {
    color: #888;
}

.source-item .source-links {
    margin-top: 6px;
}

.source-item .source-links a {
    color: #48dbfb;
    text-decoration: none;
    font-size: 0.8rem;
    margin-right: 10px;
}

.source-item .source-links a:hover {
    text-decoration: underline;
}

.comp-tag {
    display: inline-block;
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-right: 5px;
    margin-top: 4px;
}

/* Sales list */
.sales-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
}

.sales-list li {
    padding: 8px 12px;
    margin-bottom: 6px;
    background: rgba(46, 204, 113, 0.1);
    border-left: 3px solid #2ecc71;
    border-radius: 0 6px 6px 0;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
}

.sales-list li:last-child {
    margin-bottom: 0;
}

/* No data styling */
.no-data {
    color: #e74c3c;
    font-style: italic;
    font-size: 0.9rem;
}

.no-data-hint {
    color: #95a5a6;
    font-size: 0.75rem;
    font-style: italic;
}

.value-card:has(.no-data) {
    opacity: 0.7;
    border-color: #444;
}

.profit-no-data {
    text-align: center;
    padding: 20px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 8px;
    border: 1px dashed #e74c3c;
}

.profit-no-data .no-data {
    display: block;
    font-size: 1rem;
    margin-bottom: 10px;
}

.profit-no-data p {
    color: #95a5a6;
    font-size: 0.85rem;
    margin: 0;
}

/* Collapsible sections */
.collapsible-section {
    margin-bottom: 15px;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    margin: 0;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    font-size: 1rem;
}

.section-header:hover {
    background: rgba(255, 255, 255, 0.08);
}

.section-header .info-tooltip {
    margin-left: 5px;
    margin-right: auto;
}

.collapse-icon {
    font-size: 0.7rem;
    color: #888;
    transition: transform 0.3s ease;
    margin-left: 10px;
}

.collapsible-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.section-content {
    padding: 15px;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
    max-height: 1000px;
    opacity: 1;
}

.collapsible-section.collapsed .section-content {
    max-height: 0;
    padding: 0 15px;
    opacity: 0;
    overflow: hidden;
}

/* Adjust nested h3 styles that are now headers */
.collapsible-section h3.section-header {
    border-bottom: none;
}

/* Remove old h3 styling from modal sections */
.modal-content > .collapsible-section > .section-content > h3 {
    display: none;
}

/* Grade Prediction */
.grade-prediction {
    margin-bottom: 25px;
}

.prediction-content {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
}

.predicted-grades {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
}

.predicted-grade {
    background: rgba(46, 204, 113, 0.2);
    border: 1px solid rgba(46, 204, 113, 0.3);
    border-radius: 8px;
    padding: 10px 15px;
    text-align: center;
}

.predicted-grade .company {
    font-size: 0.8rem;
    color: #888;
}

.predicted-grade .grade {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2ecc71;
}

.grade-reasoning {
    color: #a0a0a0;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Recommendation */
.recommendation {
    margin-bottom: 25px;
}

.recommendation-content {
    border-radius: 12px;
    padding: 20px;
}

.recommendation-content.should-grade {
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.recommendation-content.should-not-grade {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.recommendation-verdict {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.verdict-icon {
    font-size: 1.5rem;
}

.verdict-text {
    font-size: 1.2rem;
    font-weight: 700;
}

.recommendation-content.should-grade .verdict-text {
    color: #2ecc71;
}

.recommendation-content.should-not-grade .verdict-text {
    color: #ff6b6b;
}

.recommended-service {
    background: rgba(255, 255, 255, 0.1);
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #48dbfb;
    margin-bottom: 12px;
}

.recommendation-reasoning {
    color: #a0a0a0;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Profit Analysis */
.profit-analysis {
    margin-bottom: 25px;
}

.profit-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.profit-scenario {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}

.profit-scenario .scenario-label {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 8px;
}

.profit-scenario .profit-value {
    font-size: 1.3rem;
    font-weight: 700;
}

.profit-scenario .profit-value.positive {
    color: #2ecc71;
}

.profit-scenario .profit-value.negative {
    color: #ff6b6b;
}

.profit-scenario.best-case {
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.profit-scenario.expected {
    border: 1px solid rgba(72, 219, 251, 0.3);
}

.profit-scenario.worst-case {
    border: 1px solid rgba(255, 107, 107, 0.3);
}

/* Market Notes */
.market-notes {
    background: rgba(254, 202, 87, 0.1);
    border: 1px solid rgba(254, 202, 87, 0.3);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.market-notes h4 {
    color: #feca57;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.market-notes p {
    color: #a0a0a0;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Disclaimer */
.disclaimer {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 12px;
    font-size: 0.75rem;
    color: #666;
    line-height: 1.5;
}

/* Error State */
.modal-error {
    padding: 60px 40px;
    text-align: center;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.modal-error h3 {
    color: #ff6b6b;
    margin-bottom: 10px;
}

.modal-error p {
    color: #888;
    margin-bottom: 20px;
}

.retry-btn {
    padding: 12px 30px;
    background: #667eea;
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}

/* Header Saved Cards Button */
.saved-cards-btn {
    position: absolute;
    top: 30px;
    right: 30px;
    padding: 10px 20px;
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid #667eea;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.saved-cards-btn:hover {
    background: #667eea;
    color: white;
}

header {
    position: relative;
}

/* Modal Save Button */
.modal-actions {
    display: flex;
    justify-content: center;
    padding: 20px;
    border-top: 1px solid #333;
    margin-top: 20px;
}

.save-card-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s;
}

.save-card-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.save-card-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Saved Cards Modal */
.saved-cards-modal {
    background: #1e1e2e;
    border-radius: 16px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.saved-cards-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #333;
}

.saved-cards-header h2 {
    font-size: 1.5rem;
    color: #fff;
}

.saved-cards-search {
    padding: 15px 25px;
    border-bottom: 1px solid #333;
}

.saved-cards-search input {
    width: 100%;
    padding: 12px 15px;
    background: #2a2a3e;
    border: 1px solid #444;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
}

.saved-cards-search input::placeholder {
    color: #666;
}

.saved-cards-search input:focus {
    outline: none;
    border-color: #667eea;
}

.saved-cards-grid {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

/* Saved Card Tile */
.saved-card-tile {
    background: #2a2a3e;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.saved-card-tile:hover {
    transform: translateY(-3px);
    border-color: #667eea;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.card-thumbnail {
    width: 100%;
    height: 150px;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-thumbnail img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.card-thumbnail .no-thumb {
    font-size: 3rem;
    opacity: 0.3;
}

.card-tile-info {
    padding: 12px 15px;
}

.card-tile-player {
    font-weight: 600;
    font-size: 1rem;
    color: #fff;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-tile-details {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-tile-grade {
    display: inline-block;
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.card-tile-date {
    font-size: 0.7rem;
    color: #666;
    margin-top: 8px;
}

/* Link badge on card thumbnail */
.link-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.card-thumbnail {
    position: relative;
}

.card-tile-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 15px;
    border-top: 1px solid #333;
    background: rgba(0, 0, 0, 0.2);
}

.card-tile-actions button {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #444;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.load-card-btn:hover {
    background: #667eea;
    border-color: #667eea;
}

.delete-card-btn:hover {
    background: #e74c3c;
    border-color: #e74c3c;
}

/* Empty/Loading States */
.no-cards, .loading-cards, .error-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-cards-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.no-cards p {
    margin: 5px 0;
}

.no-cards .hint {
    font-size: 0.85rem;
    color: #555;
}

.error-loading {
    color: #e74c3c;
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #2ecc71;
    color: white;
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* External Link Container */
.external-link-container {
    margin: 15px 0;
    padding: 12px;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
}

.external-link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 15px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

.external-link-btn:hover {
    background: #5a6fd6;
    transform: translateY(-1px);
}

/* Saved Card Info Panel */
.saved-card-info-panel {
    width: 280px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.saved-card-info-panel h3 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: #fff;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.card-info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.card-info-label {
    color: #888;
    font-size: 0.85rem;
}

.card-info-value {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

.card-info-link {
    margin-top: 15px;
}

.card-info-link a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.card-info-link a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.card-info-notes {
    margin-top: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 0.85rem;
    color: #aaa;
    line-height: 1.4;
}

.card-info-notes-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.no-saved-info {
    color: #666;
    font-size: 0.9rem;
    text-align: center;
    padding: 20px;
}

/* Action Buttons Row */
.action-buttons {
    display: flex;
    gap: 12px;
}

.quick-save-btn {
    flex: 1;
    padding: 14px 20px;
    background: rgba(46, 204, 113, 0.2);
    border: 1px solid #2ecc71;
    color: #2ecc71;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.quick-save-btn:hover {
    background: #2ecc71;
    color: white;
}

/* Quick Save Modal */
.quick-save-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.quick-save-content {
    background: #1e1e2e;
    border-radius: 16px;
    padding: 25px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.quick-save-content h3 {
    margin: 0 0 5px 0;
    color: #fff;
}

.quick-save-hint {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.quick-save-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-row label {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
}

.form-row input,
.form-row textarea {
    padding: 10px 12px;
    background: #2a2a3e;
    border: 1px solid #444;
    border-radius: 6px;
    color: #fff;
    font-size: 0.95rem;
}

.form-row input:focus,
.form-row textarea:focus {
    outline: none;
    border-color: #2ecc71;
}

.form-row textarea {
    min-height: 60px;
    resize: vertical;
}

.form-hint {
    font-size: 0.75rem;
    color: #666;
    margin-top: 4px;
}

.quick-save-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.qs-cancel {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: 1px solid #444;
    color: #888;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.qs-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.qs-save {
    flex: 2;
    padding: 12px;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
}

.qs-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.qs-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Responsive */
@media (max-width: 900px) {
    header {
        grid-template-columns: auto 1fr auto;
    }

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

    .subtitle {
        font-size: 0.85rem;
    }

    .main-content {
        flex-direction: column;
    }

    .stats-panel {
        width: 100%;
        order: 2;
    }

    .canvas-container {
        order: 1;
    }

    .saved-cards-btn {
        position: static;
        margin-top: 15px;
    }

    .saved-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 600px) {
    header {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        text-align: center;
    }

    .header-user-menu {
        grid-row: 1;
        grid-column: 1;
        justify-self: start;
    }

    .header-center {
        grid-row: 1;
        grid-column: 1;
    }

    .header-right {
        grid-row: 2;
        grid-column: 1;
        justify-self: center;
        margin-top: 10px;
    }
}

