/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --dark-light: #334155;
    --gray: #64748b;
    --gray-light: #e2e8f0;
    --white: #ffffff;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark);
}

input, select, button {
    max-width: 100%;
}

/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-card {
    background: var(--white);
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    padding: 3rem;
    max-width: 420px;
    width: 100%;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.login-header .subtitle {
    color: var(--gray);
    font-size: 0.875rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.875rem;
}

.form-group input {
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-light);
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.error-message {
    background: #fee2e2;
    color: var(--danger);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    border-left: 4px solid var(--danger);
}

.btn-login {
    background: var(--gradient-primary);
    color: var(--white);
    padding: 1rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.btn-login:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-footer {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--gray);
    font-size: 0.875rem;
}

.login-footer code {
    background: var(--gray-light);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: var(--primary);
}

/* Main App Styles */
.main-container {
    min-height: 100vh;
    background: #f8fafc;
}

.app-container {
    display: flex;
    min-height: 100vh;
    background: #f8fafc;
}

.sidebar {
    width: 320px;
    background: var(--white);
    border-right: 1px solid var(--gray-light);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar h2 {
    font-size: 1.25rem;
    color: var(--dark);
    margin-bottom: 1rem;
}




.app-header {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    font-size: 1.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.update-time {
    color: var(--gray);
    font-size: 0.875rem;
}

.btn-logout {
    padding: 0.5rem 1.25rem;
    background: var(--white);
    border: 2px solid var(--gray-light);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.btn-logout:hover {
    background: var(--gray-light);
}

.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0;
}

.strategy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.strategy-header h1 {
    font-size: 1.75rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.last-update {
    color: var(--gray);
    font-size: 0.875rem;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    gap: 1.5rem;
    color: var(--gray);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-light);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}






/* Strategy Tabs */
.strategy-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: var(--white);
    border: 2px solid var(--gray-light);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    white-space: nowrap;
}

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

.tab-btn.active {
    background: var(--gradient-primary);
    color: var(--white);
    border-color: transparent;
}

/* Signals Section */
.signals-section {
    background: var(--white);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.5rem;
    color: var(--dark);
}

.btn-refresh {
    padding: 0.625rem 1.25rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

.btn-refresh:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-refresh:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray);
}

/* Signal Cards Grid */
.signals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.signal-card {
    background: var(--white);
    border: 2px solid var(--gray-light);
    border-radius: 12px;
    padding: 1.5rem;
    transition: var(--transition);
}

.signal-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.signal-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--gray-light);
    padding-bottom: 1rem;
}

.signal-header h3 {
    font-size: 1.125rem;
    color: var(--dark);
}

.confidence-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.confidence-badge.high {
    background: var(--gradient-success);
    color: var(--white);
}

.confidence-badge.medium {
    background: var(--warning);
    color: var(--white);
}

.confidence-badge.low {
    background: var(--gray-light);
    color: var(--gray);
}

.signal-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.signal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.signal-row .label {
    color: var(--gray);
    font-size: 0.875rem;
}

.signal-row .value {
    font-weight: 600;
    color: var(--dark);
}

.signal-row .value.signal-buy {
    color: var(--success);
}

.signal-row .value.signal-sell {
    color: var(--danger);
}

.signal-row .value.support {
    color: var(--warning);
}

.signal-row .value.target {
    color: var(--success);
}

.signal-reason {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-light);
}

.signal-reason .label {
    color: var(--gray);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    display: block;
}

.signal-reason p {
    color: var(--dark);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        background: #f8fafc;
    }

    .app-container {
        flex-direction: column;
        min-height: 100vh;
    }

    .sidebar {
        width: 100%;
        position: static;
        height: auto;
        overflow: visible;
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--gray-light);
    }

    .main-content {
        padding: 1rem;
        max-width: 100%;
    }

    .strategy-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 0.75rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .signals-grid {
        grid-template-columns: 1fr;
    }

    .strategy-tabs {
        flex-wrap: wrap;
    }
}

/* Watchlist Section */
.watchlist-section {
    background: var(--white);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.btn-search {
    padding: 0.625rem 1.25rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

.btn-search:hover {
    background: var(--primary-dark);
}

/* Search Box */
.search-box {
    margin: 1.5rem 0;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.search-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--gray-light);
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-results {
    margin-top: 1rem;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--gray-light);
    border-radius: 10px;
    background: var(--white);
}

.search-item {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--gray-light);
}

.search-item:hover {
    background: #f8fafc;
}

.search-item .code {
    color: var(--gray);
    font-size: 0.875rem;
}

.industry-tag {
    background: var(--gray-light);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--gray);
}

.stock-info {
    display: flex;
    flex-direction: column;
}

.stock-info .name {
    font-weight: 600;
}

.stock-info .code {
    font-size: 0.75rem;
    opacity: 0.8;
}

.remove-btn {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.remove-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}


/* Watchlist Grid */
.watchlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.watchlist-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 1.25rem;
    color: var(--white);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.watchlist-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.watchlist-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.watchlist-card h3 {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
}

.stock-code-small {
    font-size: 0.75rem;
    opacity: 0.8;
}

.btn-remove {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

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

.empty-watchlist {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray);
}

/* Overview Section */
.overview-section {
    margin-top: 2rem;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.overview-card {
    background: var(--white);
    border: 2px solid var(--gray-light);
    border-radius: 12px;
    padding: 1.5rem;
    transition: var(--transition);
}

.overview-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.overview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-light);
}

.overview-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.signal-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 1.125rem;
    font-weight: 600;
}

.signal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.signal-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: 6px;
    font-size: 0.875rem;
}

.signal-reason {
    padding: 0.75rem;
    background: #fffbeb;
    border-left: 4px solid var(--warning);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--dark);
}

/* Tab Navigation */
.tab-navigation {
    background: var(--white);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    overflow-x: auto;
}

/* Responsive Updates */
@media (max-width: 768px) {
    .watchlist-grid {
        grid-template-columns: 1fr;
    }

    .overview-grid {
        grid-template-columns: 1fr;
    }

    .signal-grid {
        grid-template-columns: 1fr;
    }
}
