/* Design Tokens & Custom Palette */
:root {
    --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Harmonious Dark Mode Colors */
    --bg-main: #080d1a;
    --panel-bg: rgba(18, 26, 48, 0.65);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-main: #f3f6fc;
    --text-muted: #8ea1c4;
    
    /* Vibrant Accent Colors */
    --color-primary: #4f46e5; /* Deep violet */
    --color-primary-hover: #6366f1;
    --color-accent: #06b6d4; /* Cyan */
    --color-success: #10b981; /* Emerald green */
    --color-danger: #ef4444; /* Vibrant red */
    --color-warning: #f59e0b; /* Amber yellow */
    
    /* Shadows & Blurs */
    --shadow-glass: 0 12px 40px 0 rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.35);
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Core Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
    mix-blend-mode: screen;
}

.blob-1 {
    top: -10%;
    left: 10%;
    width: 400px;
    height: 400px;
    background-color: var(--color-primary);
    animation: floatBlob 20s infinite alternate;
}

.blob-2 {
    bottom: 10%;
    right: 10%;
    width: 500px;
    height: 500px;
    background-color: var(--color-accent);
    animation: floatBlob 25s infinite alternate-reverse;
}

.blob-3 {
    top: 40%;
    left: 50%;
    width: 350px;
    height: 350px;
    background-color: rgba(168, 85, 247, 0.5);
    animation: floatBlob 18s infinite alternate;
}

@keyframes floatBlob {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, -50px) scale(1.15); }
    100% { transform: translate(-20px, 30px) scale(0.95); }
}

/* Glassmorphism Panel Base */
.glass-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
    padding: 25px;
    transition: var(--transition-smooth);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* Layout Container */
.dashboard-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Header Styles */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-icon {
    width: 38px;
    height: 38px;
    color: var(--color-accent);
    filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.6));
}

.main-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #d1dcf0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Ntfy Card Header Block */
.ntfy-status-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ntfy-status-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ntfy-icon {
    width: 14px;
    height: 14px;
    animation: pulseNtfy 2s infinite;
}

@keyframes pulseNtfy {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.6; }
    100% { transform: scale(1); opacity: 1; }
}

.ntfy-topic-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

#ntfy-topic-display {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 25px;
}

@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

/* Card Headers */
.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    position: relative;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.section-icon {
    width: 22px;
    height: 22px;
}

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

/* Tabs Styles */
.tabs-container {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

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

.tab-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tab-icon {
    width: 16px;
    height: 16px;
}

/* Form Controls */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.col { flex: 1; }
.col-2 { flex: 2; }

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="text"],
input[type="number"],
select {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    color: var(--text-main);
    padding: 12px 16px;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
    width: 100%;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.2);
    background: rgba(0, 0, 0, 0.35);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%238ea1c4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Input with inline fetch action */
.input-with-action {
    display: flex;
    gap: 10px;
}

.input-with-action input {
    flex: 1;
}

.help-text {
    font-size: 0.8rem;
    color: var(--color-accent);
    margin-top: -4px;
    min-height: 18px;
}

/* Button Styles */
.btn {
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, rgba(79, 70, 229, 0.8) 100%);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(79, 70, 229, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-block {
    width: 100%;
    margin-top: 10px;
}

.btn-sm {
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}

.btn-icon { width: 18px; height: 18px; }
.btn-icon-sm { width: 14px; height: 14px; }

/* Utility classes */
.hidden { display: none !important; }

/* Animation and spin helper */
.spin {
    animation: rotate-spinner 1s linear infinite;
}

@keyframes rotate-spinner {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Alert Trigger History List */
.history-list-container {
    max-height: 350px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 5px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.history-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
}

.history-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.history-ticker {
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-price-triggered {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.price-val {
    font-weight: 700;
    font-size: 1rem;
}

.history-condition-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Active Alerts Section */
.alerts-section {
    margin-top: 10px;
}

.alerts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.alerts-header .card-header {
    margin-bottom: 0;
}

.badge-count {
    background: var(--color-primary);
    color: white;
    padding: 2px 10px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-left: 8px;
}

.alerts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    min-height: 120px;
}

/* Alert Card UI */
.alert-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.alert-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glass);
    border-color: rgba(255, 255, 255, 0.1);
}

.alert-card.inactive {
    opacity: 0.55;
}

.alert-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.alert-card.stock::before { background-color: var(--color-accent); }
.alert-card.option.call::before { background-color: var(--color-success); }
.alert-card.option.put::before { background-color: var(--color-danger); }

.alert-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.alert-ticker-desc {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.alert-ticker-name {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.alert-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.alert-badge.stock { background: rgba(6, 182, 212, 0.15); color: var(--color-accent); }
.alert-badge.call { background: rgba(16, 185, 129, 0.15); color: var(--color-success); }
.alert-badge.put { background: rgba(239, 68, 68, 0.15); color: var(--color-danger); }

.alert-card-body {
    margin-bottom: 18px;
}

.alert-metric {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.alert-metric:last-child {
    border-bottom: none;
}

.metric-label { color: var(--text-muted); }
.metric-val { font-weight: 600; }

.target-price-val {
    color: var(--color-warning);
    font-weight: 700;
}

.alert-card-actions {
    display: flex;
    gap: 10px;
}

.alert-card-actions button {
    flex: 1;
}

/* Empty states */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.empty-icon {
    width: 32px;
    height: 32px;
    color: rgba(255, 255, 255, 0.15);
}

/* Toast System styling */
#toast-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(18, 26, 48, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    padding: 14px 20px;
    border-radius: var(--radius-md);
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-glass);
    min-width: 280px;
    transform: translateY(50px);
    opacity: 0;
    animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast-success { border-left: 4px solid var(--color-success); }
.toast-error { border-left: 4px solid var(--color-danger); }
.toast-info { border-left: 4px solid var(--color-accent); }

.toast-icon { width: 18px; height: 18px; }
.toast-success .toast-icon { color: var(--color-success); }
.toast-error .toast-icon { color: var(--color-danger); }
.toast-info .toast-icon { color: var(--color-accent); }

@keyframes toastIn {
    to { transform: translateY(0); opacity: 1; }
}

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