/* Alphabot Raffles - Main Stylesheet */

/* CSS Variables */
:root {
    --primary: #00b894;
    --primary-dark: #00a383;
    --danger: #d63031;
    --danger-dark: #c0221f;
    --success: #00b894;
    --warning: #fdcb6e;
    --info: #74b9ff;
    
    --bg-color: #f5f6fa;
    --card-bg: #ffffff;
    --text-color: #2d3436;
    --text-secondary: #636e72;
    --border-color: #dfe6e9;
    
    --header-bg: #ffffff;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.15);
    
    --transition: all 0.2s ease;
}

/* Dark Mode Variables */
.dark-mode {
    --bg-color: #1e1e1e;
    --card-bg: #2d3436;
    --text-color: #f5f6fa;
    --text-secondary: #b2bec3;
    --border-color: #4a4a4a;
    --header-bg: #2d3436;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.4);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
}

/* RTL Support */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .header-actions {
    flex-direction: row-reverse;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--header-bg);
    box-shadow: var(--shadow);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo h1 {
    font-size: 1.5rem;
    color: var(--primary);
    margin: 0;
}

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

.user-email {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 180px);
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1.25rem;
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

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

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.success {
    background: rgba(0, 184, 148, 0.1);
    color: var(--success);
}

.stat-icon.danger {
    background: rgba(214, 48, 49, 0.1);
    color: var(--danger);
}

.stat-icon.info {
    background: rgba(116, 185, 255, 0.1);
    color: var(--info);
}

.stat-icon.warning {
    background: rgba(253, 203, 110, 0.1);
    color: var(--warning);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-color);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.1);
}

.form-text {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group .form-control {
    flex: 1;
}

.password-input {
    position: relative;
    display: flex;
    gap: 0.5rem;
}

.toggle-password {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 184, 148, 0.3);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--text-color);
}

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

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

.btn-block {
    width: 100%;
    display: block;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-icon {
    padding: 0.5rem;
    font-size: 1.2rem;
    background: none;
    border: 1px solid var(--border-color);
}

.btn-loader {
    display: inline-block;
    animation: spin 1s linear infinite;
}

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

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-success {
    background: rgba(0, 184, 148, 0.2);
    color: var(--success);
}

.badge-danger {
    background: rgba(214, 48, 49, 0.2);
    color: var(--danger);
}

.badge-warning {
    background: rgba(253, 203, 110, 0.2);
    color: var(--warning);
}

.badge-info {
    background: rgba(116, 185, 255, 0.2);
    color: var(--info);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(0, 184, 148, 0.1);
    color: var(--success);
    border-left: 4px solid var(--success);
}

.alert-error {
    background: rgba(214, 48, 49, 0.1);
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

.alert-info {
    background: rgba(116, 185, 255, 0.1);
    color: var(--info);
    border-left: 4px solid var(--info);
}

/* Progress Bar */
.progress {
    background: var(--border-color);
    border-radius: 4px;
    height: 30px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary), var(--success));
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    transition: width 0.3s ease;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

[dir="rtl"] .table th,
[dir="rtl"] .table td {
    text-align: right;
}

.table th {
    font-weight: 600;
    color: var(--text-color);
    background: rgba(0, 0, 0, 0.02);
}

.dark-mode .table th {
    background: rgba(255, 255, 255, 0.05);
}

.table tbody tr:hover {
    background: rgba(0, 184, 148, 0.05);
}

.table tbody tr.success {
    background: rgba(0, 184, 148, 0.05);
}

.table tbody tr.failed {
    background: rgba(214, 48, 49, 0.05);
}

/* Filters */
.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.pagination button,
.pagination span {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.pagination button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button.active {
    background: var(--primary);
    color: white;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* API Key Status */
.api-key-status {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-item .label {
    font-weight: 500;
}

/* Results Summary */
.results-summary {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 4px;
    margin-top: 1rem;
    text-align: center;
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
}

.auth-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 450px;
}

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

.auth-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Footer */
.footer {
    background: var(--header-bg);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-secondary);
    box-shadow: var(--shadow);
    margin-top: 2rem;
}

/* Utility Classes */
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.text-center { text-align: center; }

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-row {
        grid-template-columns: 1fr;
    }
    
    .api-key-status {
        flex-direction: column;
        gap: 1rem;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .card-body,
    .card-header {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}
