/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-bg: #0f0f0f;
    --card-bg: #1a1a1a;
    --card-bg-light: #252525;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-andar: #00d4aa;
    --accent-bahar: #ff4757;
    --accent-gold: #ffd700;
    --border-color: #333333;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    --radius: 16px;
    --radius-sm: 8px;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--primary-bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 32px;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 20px;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-gold), #ff8c00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

.stats-bar {
    display: flex;
    justify-content: space-around;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-value.andar {
    color: var(--accent-andar);
}

.stat-value.bahar {
    color: var(--accent-bahar);
}

/* Prediction Section */
.prediction-section {
    margin-bottom: 20px;
}

.prediction-card {
    background: linear-gradient(145deg, var(--card-bg), var(--card-bg-light));
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.prediction-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-andar), var(--accent-bahar));
}

.prediction-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.prediction-result {
    margin-bottom: 16px;
}

.prediction-text {
    font-size: 2rem;
    font-weight: 700;
    display: block;
}

.prediction-text.andar-prediction {
    color: var(--accent-andar);
    text-shadow: 0 0 20px rgba(0, 212, 170, 0.3);
}

.prediction-text.bahar-prediction {
    color: var(--accent-bahar);
    text-shadow: 0 0 20px rgba(255, 71, 87, 0.3);
}

.confidence-bar {
    height: 8px;
    background: var(--card-bg-light);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.confidence-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-andar), var(--accent-bahar));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.confidence-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Trend Section */
.trend-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.trend-section h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.trend-chart {
    margin-bottom: 12px;
}

.trend-bars {
    display: flex;
    gap: 12px;
    height: 120px;
    align-items: flex-end;
}

.trend-bar {
    flex: 1;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 12px 8px;
    min-height: 40px;
    transition: all 0.3s ease;
}

.trend-bar.andar-bar {
    background: linear-gradient(180deg, rgba(0, 212, 170, 0.3), rgba(0, 212, 170, 0.1));
    border: 2px solid var(--accent-andar);
}

.trend-bar.bahar-bar {
    background: linear-gradient(180deg, rgba(255, 71, 87, 0.3), rgba(255, 71, 87, 0.1));
    border: 2px solid var(--accent-bahar);
}

.bar-label {
    font-size: 1.25rem;
    font-weight: 700;
}

.andar-bar .bar-label {
    color: var(--accent-andar);
}

.bahar-bar .bar-label {
    color: var(--accent-bahar);
}

.bar-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.trend-status {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 8px;
    background: var(--card-bg-light);
    border-radius: var(--radius-sm);
}

/* Quick Add Section */
.quick-add-section {
    margin-bottom: 20px;
}

.quick-add-section h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.btn {
    border: none;
    border-radius: var(--radius);
    padding: 16px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-andar {
    background: linear-gradient(145deg, rgba(0, 212, 170, 0.2), rgba(0, 212, 170, 0.1));
    color: var(--accent-andar);
    border: 2px solid var(--accent-andar);
}

.btn-andar:hover {
    background: var(--accent-andar);
    color: var(--primary-bg);
}

.btn-bahar {
    background: linear-gradient(145deg, rgba(255, 71, 87, 0.2), rgba(255, 71, 87, 0.1));
    color: var(--accent-bahar);
    border: 2px solid var(--accent-bahar);
}

.btn-bahar:hover {
    background: var(--accent-bahar);
    color: var(--text-primary);
}

.btn-undo {
    width: 100%;
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    flex-direction: row;
    justify-content: center;
}

.btn-undo:hover:not(:disabled) {
    background: var(--card-bg-light);
    color: var(--text-primary);
}

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

.btn-icon {
    font-size: 1.5rem;
}

.btn-text {
    font-size: 1rem;
}

/* History Section */
.history-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

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

.history-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.btn-clear {
    padding: 8px 16px;
    font-size: 0.875rem;
    background: transparent;
    color: var(--accent-bahar);
    border: 1px solid var(--accent-bahar);
    border-radius: var(--radius-sm);
}

.btn-clear:hover {
    background: var(--accent-bahar);
    color: var(--text-primary);
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--card-bg-light);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border-left: 4px solid transparent;
}

.history-item.andar {
    border-left-color: var(--accent-andar);
}

.history-item.bahar {
    border-left-color: var(--accent-bahar);
}

.history-number {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.history-result {
    font-size: 1rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
}

.history-result.andar {
    background: rgba(0, 212, 170, 0.2);
    color: var(--accent-andar);
}

.history-result.bahar {
    background: rgba(255, 71, 87, 0.2);
    color: var(--accent-bahar);
}

.history-actions {
    display: flex;
    gap: 8px;
}

.btn-delete {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-delete:hover {
    opacity: 1;
    color: var(--accent-bahar);
}

.empty-state {
    text-align: center;
    padding: 32px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Pattern Section */
.pattern-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.pattern-section h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.pattern-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.pattern-item {
    background: var(--card-bg-light);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}

.pattern-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.pattern-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-gold);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--card-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.pulse {
    animation: pulse 2s infinite;
}

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

.history-item {
    animation: slideIn 0.3s ease;
}

/* Responsive */
@media (max-width: 380px) {
    html {
        font-size: 14px;
    }
    
    .app-container {
        padding: 12px;
    }
    
    .stats-bar {
        padding: 12px;
    }
    
    .btn {
        padding: 14px;
    }
}

/* Landscape mode */
@media (max-height: 500px) and (orientation: landscape) {
    .app-container {
        max-width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
    
    .app-header {
        grid-column: 1 / -1;
    }
    
    .prediction-section,
    .trend-section {
        margin-bottom: 0;
    }
}