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

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f7fa;
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
    color: white;
    padding: 16px 24px;
    box-shadow: var(--shadow-md);
}

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

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 32px;
    height: 32px;
}

.header-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.header-nav {
    display: flex;
    gap: 24px;
}

.header-nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.header-nav a:hover, .header-nav a.active {
    color: white;
}

.user-greeting {
    color: rgba(255,255,255,0.8);
    font-size: 0.875rem;
}

.nav-logout {
    background-color: rgba(255,255,255,0.1);
    padding: 6px 12px;
    border-radius: 6px;
}

.nav-logout:hover {
    background-color: rgba(255,255,255,0.2);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Dashboard Layout */
.dashboard {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
}

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

/* Sidebar */
.sidebar h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--gray-800);
}

.action-code-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.summary-card {
    display: block;
    background: white;
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
}

.summary-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.summary-card.selected {
    border-color: var(--primary);
    background-color: #f0f7ff;
}

.summary-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.code-indicator {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
}

.code-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-800);
}

.summary-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.summary-bar {
    height: 6px;
    background: var(--gray-100);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.summary-bar-fill {
    height: 100%;
    border-radius: 3px;
}

.summary-description {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Filters */
.filters {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.filters-form {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--gray-400);
}

.search-box input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.875rem;
}

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

.filters-info {
    margin-top: 12px;
    font-size: 0.813rem;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filters-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    flex-wrap: wrap;
    gap: 12px;
}

.filters-actions .filters-info {
    margin-top: 0;
}

.btn-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--success);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.15s;
}

.btn-add:hover {
    background-color: #059669;
}

.btn-add svg {
    width: 16px;
    height: 16px;
}

.btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    color: var(--gray-400);
    border: none;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-delete:hover {
    background-color: #fef2f2;
    color: var(--danger);
}

.btn-delete svg {
    width: 18px;
    height: 18px;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.875rem;
}

.alert-success {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 10px;
    background: var(--primary);
    color: white;
    border-radius: 16px;
    font-size: 0.75rem;
}

.active-filter-tag a {
    color: white;
    text-decoration: none;
    font-size: 1rem;
    line-height: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

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

.btn-secondary {
    background-color: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background-color: var(--gray-200);
}

/* Stock Table */
.stock-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.stock-table {
    width: 100%;
    border-collapse: collapse;
}

.stock-table th {
    background: var(--gray-50);
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.stock-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
}

.stock-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s;
}

.stock-table tbody tr:hover {
    background-color: var(--gray-50);
}

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.symbol {
    font-weight: 600;
    color: var(--primary);
}

.company-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.company-name {
    font-weight: 500;
    color: var(--gray-800);
}

.company-industry {
    font-size: 0.75rem;
    color: var(--gray-400);
}

.action-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.action-badge.large {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.empty-state {
    padding: 48px;
    text-align: center;
    color: var(--gray-500);
}

/* Stock Detail Page */
.stock-detail {
    max-width: 800px;
    margin: 0 auto;
}

.back-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 8px;
    display: inline-block;
}

.back-link:hover {
    text-decoration: underline;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.detail-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.detail-header .company-name {
    font-size: 1.125rem;
    color: var(--gray-600);
}

.detail-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.meta-tag {
    padding: 4px 12px;
    background: var(--gray-100);
    border-radius: 16px;
    font-size: 0.813rem;
    color: var(--gray-600);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 600px) {
    .detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.detail-card {
    background: var(--gray-50);
    padding: 16px;
    border-radius: 10px;
}

.detail-card h3 {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-500);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.detail-card .value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
}

.detail-card .value.large {
    font-size: 1.5rem;
}

.detail-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.detail-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.price-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: 6px;
    font-size: 0.875rem;
}

.price-row .year {
    font-weight: 500;
}

.dividend-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.dividend-grid > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dividend-grid .label {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.dividend-grid .value {
    font-weight: 600;
    color: var(--gray-800);
}

.action-analysis {
    background: var(--gray-50);
    padding: 16px;
    border-radius: 8px;
    font-size: 0.875rem;
}

/* Error Container */
.error-container {
    text-align: center;
    padding: 80px 20px;
}

.error-container h2 {
    color: var(--danger);
    margin-bottom: 8px;
}

.error-container p {
    color: var(--gray-600);
    margin-bottom: 24px;
}

/* Footer */
.footer {
    background: var(--gray-100);
    padding: 16px 24px;
    text-align: center;
    color: var(--gray-500);
    font-size: 0.875rem;
}
