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

html {
    height: auto;
    min-height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #0f1419;
    color: #e7e9ea;
    min-height: 100vh;
    line-height: 1.5;
    height: auto;
    overflow-y: auto;
}

/* Login Page Styles */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f1419 0%, #1a1f2e 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: #1e2732;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    margin-bottom: 16px;
}

.logo-icon {
    font-size: 48px;
    color: #1d9bf0;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.subtitle {
    color: #71767b;
    font-size: 14px;
}

.error-message {
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid #f44336;
    color: #f44336;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #e7e9ea;
}

.login-form input {
    width: 100%;
    padding: 14px 16px;
    background: #273340;
    border: 1px solid #38444d;
    border-radius: 8px;
    color: #e7e9ea;
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: #1d9bf0;
    box-shadow: 0 0 0 3px rgba(29, 155, 240, 0.2);
}

.login-form input::placeholder {
    color: #71767b;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: #1d9bf0;
    color: white;
    border: none;
    border-radius: 9999px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.login-btn:hover {
    background: #1a8cd8;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: #71767b;
    font-size: 13px;
}

/* Dashboard Page Styles */
.dashboard-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-y: auto;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #1e2732;
    border-bottom: 1px solid #38444d;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.header-left .logo-icon {
    font-size: 28px;
    color: #1d9bf0;
}

.header-left h1 {
    font-size: 20px;
    font-weight: 700;
}

.main-nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    color: #e7e9ea;
    text-decoration: none;
    border-radius: 9999px;
    transition: background-color 0.2s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    background: rgba(29, 155, 240, 0.2);
    color: #1d9bf0;
}

.nav-icon {
    font-size: 18px;
}

.header-right {
    display: flex;
    align-items: center;
}

.logout-btn {
    padding: 8px 16px;
    background: transparent;
    color: #f44336;
    border: 1px solid #f44336;
    border-radius: 9999px;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s;
}

.logout-btn:hover {
    background: rgba(244, 67, 54, 0.1);
}

.main-content {
    padding: 32px 24px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
    overflow: visible;
}

/* Dashboard Section */
.dashboard-section {
    margin-bottom: 32px;
}

.dashboard-section h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.section-description {
    color: #71767b;
    margin-bottom: 24px;
}

.scrape-form-card {
    background: #1e2732;
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
}

.scrape-form-card h3 {
    font-size: 18px;
    margin-bottom: 20px;
}

.scrape-form .form-group {
    margin-bottom: 20px;
}

.scrape-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.scrape-form input {
    width: 100%;
    padding: 12px 16px;
    background: #273340;
    border: 1px solid #38444d;
    border-radius: 8px;
    color: #e7e9ea;
    font-size: 16px;
}

.scrape-form input:focus {
    outline: none;
    border-color: #1d9bf0;
}

.scrape-btn {
    padding: 12px 24px;
    background: #1d9bf0;
    color: white;
    border: none;
    border-radius: 9999px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.scrape-btn:hover {
    background: #1a8cd8;
}

.scrape-status {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding: 16px;
    background: rgba(29, 155, 240, 0.1);
    border-radius: 8px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    background: #1d9bf0;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* History Section */
.history-section {
    margin-bottom: 32px;
}

.history-header {
    margin-bottom: 24px;
}

.history-header h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.history-description {
    color: #71767b;
}

.history-table-wrapper {
    background: #1e2732;
    border-radius: 16px;
    overflow: visible;
}

.data-history-table .history-table-wrapper {
    overflow: visible;
}

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

.history-table th,
.history-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid #38444d;
}

.history-table th {
    background: #273340;
    font-weight: 600;
    color: #71767b;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.history-table tr:last-child td {
    border-bottom: none;
}

.history-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.ticker-cell {
    font-weight: 600;
    color: #1d9bf0;
}

.timestamp-cell {
    color: #71767b;
    font-size: 14px;
}

.error-cell {
    font-size: 14px;
}

.error-cell .status-success {
    color: #4caf50;
    font-weight: 500;
}

.error-cell .status-error {
    color: #f44336;
}

.size-cell {
    color: #71767b;
    font-size: 14px;
}

.actions-cell {
    display: flex;
    gap: 12px;
}

.action-link {
    color: #1d9bf0;
    text-decoration: none;
    font-size: 14px;
    transition: opacity 0.2s;
}

.action-link:hover {
    opacity: 0.8;
}

.action-link.delete {
    color: #f44336;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    background: #1e2732;
    border-radius: 16px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.empty-state p {
    color: #71767b;
}

/* Stats Container */
.stats-container {
    display: flex;
    gap: 16px;
    margin-top: 24px;
    margin-bottom: 24px;
}

.stat-card {
    flex: 1;
    background: #1e2732;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 1px solid #38444d;
}

.stat-card.success {
    border-color: #4caf50;
}

.stat-card.error {
    border-color: #f44336;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #e7e9ea;
    margin-bottom: 8px;
}

.stat-card.success .stat-value {
    color: #4caf50;
}

.stat-card.error .stat-value {
    color: #f44336;
}

.stat-label {
    font-size: 14px;
    color: #71767b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Status Badge */
.status-cell {
    text-align: center;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.status-success {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
    border: 1px solid #4caf50;
}

.status-badge.status-error {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
    border: 1px solid #f44336;
}

.no-error {
    color: #71767b;
    font-style: italic;
}

/* Extracted Data Styles */
.data-cell {
    min-width: 200px;
}

.extracted-data {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.data-item {
    display: inline-block;
    background: rgba(29, 155, 240, 0.15);
    color: #1d9bf0;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.data-item:hover {
    background: rgba(29, 155, 240, 0.25);
}

.no-data {
    color: #71767b;
    font-style: italic;
    font-size: 13px;
}

/* Data History Table - clickable rows */
.data-history-table .data-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.data-history-table .data-row:hover {
    background: rgba(29, 155, 240, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }
    
    .main-nav {
        width: 100%;
        justify-content: center;
    }
    
    .actions-cell {
        flex-direction: column;
        gap: 8px;
    }
    
    .history-table {
        font-size: 14px;
    }
    
    .history-table th,
    .history-table td {
        padding: 12px 8px;
    }
    
    .stats-container {
        flex-direction: column;
    }
    
    .detail-items {
        grid-template-columns: 1fr;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .detail-content {
        padding: 16px;
    }
}
