/* Base styles and CSS variables */
:root {
    --primary-color: #4a90e2;
    --secondary-color: #2c3e50;
    --background-color: #ffffff;
    --text-color: #333333;
    --border-color: #e0e0e0;
    --success-color: #27ae60;
    --error-color: #e74c3c;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --coin-size: 200px;
}

/* Dark mode variables */
[data-theme="dark"] {
    --background-color: #1a1a1a;
    --text-color: #ffffff;
    --border-color: #404040;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header and Navigation */
header {
    background-color: var(--background-color);
    box-shadow: 0 2px 5px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.logo a {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    margin-left: 2rem;
    padding: 0.5rem;
    transition: color 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
}

/* Coin styles */
.coin-simulator {
    text-align: center;
    padding: 2rem 0;
}

.coin {
    width: var(--coin-size);
    height: var(--coin-size);
    margin: 2rem auto;
    position: relative;
    transform-style: preserve-3d;
    cursor: pointer;
}

.coin .heads,
.coin .tails {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: linear-gradient(45deg, #ffd700, #ffed4a);
    border: 8px solid #daa520;
    box-shadow: 0 0 20px var(--shadow-color);
}

.coin .heads {
    transform: rotateY(0deg);
}

.coin .tails {
    transform: rotateY(180deg);
}

/* Flip animation */
@keyframes flip {
    0% { transform: rotateY(0); }
    100% { transform: rotateY(3600deg); }
}

.coin.flipping {
    animation: flip 3s ease-out forwards;
}

/* Controls section */
.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
    padding: 1rem;
    background-color: var(--background-color);
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-weight: 600;
}

.control-group input,
.control-group select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--background-color);
    color: var(--text-color);
}

/* Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
}

.primary-button,
.secondary-button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s, opacity 0.2s;
}

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

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

.primary-button:hover,
.secondary-button:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* Results section */
.results {
    margin-top: 2rem;
}

.results-summary {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.result-box {
    background-color: var(--background-color);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-color);
    min-width: 150px;
}

.result-box h3 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.history-log {
    max-height: 300px;
    overflow-y: auto;
    padding: 1rem;
    background-color: var(--background-color);
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-color);
}

/* Fun facts section */
.fun-facts {
    margin-top: 3rem;
    padding: 1rem;
    background-color: var(--background-color);
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.fun-fact {
    margin-top: 1rem;
    font-style: italic;
}

/* Footer styles */
footer {
    background-color: var(--secondary-color);
    color: white;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    padding: 0 2rem;
}

.footer-section h4 {
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section a {
    color: white;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.footer-section a:hover {
    opacity: 1;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Theme toggle button */
.theme-toggle button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.theme-toggle button:hover {
    background-color: var(--border-color);
}

/* Responsive design */
@media (max-width: 768px) {
    .main-nav {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .nav-links a {
        margin: 0;
    }

    .coin {
        --coin-size: 150px;
    }

    .controls {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .results-summary {
        flex-direction: column;
        align-items: center;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .coin.flipping {
        animation: none;
    }
}

/* Loading states */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}
