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

:root {
    --primary-color: #FFD700;
    --secondary-color: #C0C0C0;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-color: #333;
    --text-secondary: #666;
    --border-color: #e0e0e0;
    --success-color: #4CAF50;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-color);
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
    padding: 30px;
    text-align: center;
    position: relative;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 5px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
    margin-bottom: 15px;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #666;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--success-color);
}

.status-dot.disconnected {
    background: var(--danger-color);
}

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

.tabs {
    display: flex;
    background: var(--card-bg);
    border-bottom: 2px solid var(--border-color);
    padding: 0 20px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 15px 25px;
    font-size: 1em;
    cursor: pointer;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    font-weight: 500;
}

.tab-btn:hover {
    color: var(--text-color);
    background: rgba(0, 0, 0, 0.05);
}

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

.tab-content {
    display: none;
    padding: 30px;
    min-height: 400px;
}

.tab-content.active {
    display: block;
}

.toolbar {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    background: var(--card-bg);
    cursor: pointer;
    transition: border-color 0.3s;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

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

.btn-primary:hover {
    background: #FFC700;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

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

.btn-secondary:hover {
    background: #555;
}

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

.btn-danger:hover {
    background: #d32f2f;
}

.last-update {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.rates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.rate-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    border-left: 4px solid var(--primary-color);
}

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

.rate-card.gold {
    border-left-color: #FFD700;
}

.rate-card.silver {
    border-left-color: #C0C0C0;
}

.rate-card.coin {
    border-left-color: #FFA500;
}

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

.commodity-name {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 5px;
}

.commodity-symbol {
    font-size: 0.85em;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

.commodity-type {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    background: rgba(255, 215, 0, 0.2);
    color: #B8860B;
}

.price-section {
    margin: 15px 0;
}

.price-main {
    font-size: 2em;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 5px;
}

.price-label {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-top: 1px solid var(--border-color);
    font-size: 0.9em;
}

.price-row:first-child {
    border-top: none;
}

.price-value {
    font-weight: 600;
}

.price-positive {
    color: var(--success-color);
}

.price-negative {
    color: var(--danger-color);
}

.update-time {
    font-size: 0.8em;
    color: var(--text-secondary);
    margin-top: 15px;
    text-align: right;
}

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.alert-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

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

.alert-card.inactive {
    opacity: 0.6;
}

.alert-info {
    flex: 1;
}

.alert-commodity {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 5px;
}

.alert-condition {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.alert-target {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 5px;
}

.alert-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    margin-top: 8px;
}

.alert-status.active {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success-color);
}

.alert-status.triggered {
    background: rgba(255, 152, 0, 0.2);
    color: var(--warning-color);
}

.alert-actions {
    display: flex;
    gap: 10px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 1.1em;
}

.error {
    text-align: center;
    padding: 40px;
    color: var(--danger-color);
    font-size: 1.1em;
}

.preferences-form {
    max-width: 500px;
}

.preferences-form h2 {
    margin-bottom: 25px;
    color: var(--text-color);
}

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

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

.form-group input[type="number"],
.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    transform: scale(1.2);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: var(--text-color);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: var(--text-color);
}

@media (max-width: 768px) {
    .rates-grid {
        grid-template-columns: 1fr;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .last-update {
        margin-left: 0;
        text-align: center;
    }
    
    header h1 {
        font-size: 2em;
    }
}


