:root {
    /* Variáveis do tema claro (padrão) */
    --bg-color: #f5f5f5;
    --card-bg: #fff;
    --text-color: #333;
    --secondary-text: #777;
    --border-color: #eee;
    --input-bg: #fcfcfc;
    --shadow-color: rgba(0,0,0,0.1);
    --winners-bg: #fcfcfc;
    --wheel-options-bg: #f9f9f9;
}

[data-theme="dark"] {
    /* Variáveis do tema escuro */
    --bg-color: #1e1e1e;
    --card-bg: #2d2d2d;
    --text-color: #e0e0e0;
    --secondary-text: #aaa;
    --border-color: #444;
    --input-bg: #3d3d3d;
    --shadow-color: rgba(0,0,0,0.3);
    --winners-bg: #3d3d3d;
    --wheel-options-bg: #3d3d3d;
}

body {
    font-family: 'Arial', sans-serif;
    text-align: center;
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: 10px;
    margin: 0;
    overflow-x: hidden;
    box-sizing: border-box;
    transition: background-color 0.3s ease;
}

.container {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
    gap: 30px;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}

.wheel-section {
    flex: 1 1 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-color);
    margin-bottom: 20px;
    transition: background-color 0.3s ease;
}

.right-section {
    flex: 1 1 400px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.names-section, .winners-section {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px var(--shadow-color);
    transition: background-color 0.3s ease;
}

.wheel-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: auto;
    aspect-ratio: 1/1;
    margin: 0 auto;
}

canvas {
    border-radius: 50%;
    box-shadow: 0 0 10px var(--shadow-color);
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.pointer {
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-right: 30px solid #ff0000;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}

.controls {
    margin-top: 20px;
    width: 100%;
}

button {
    background-color: #4CAF50;
    border: none;
    color: white;
    padding: 12px 25px;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #45a049;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

button i, button svg {
    margin-right: 8px;
    font-size: 18px;
}

#result {
    font-size: 24px;
    margin-top: 20px;
    color: var(--text-color);
    font-weight: bold;
    min-height: 36px;
    transition: color 0.3s ease;
}

.names-editor {
    width: 100%;
}

#names-input {
    width: 100%;
    height: 250px;
    padding: 10px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    resize: vertical;
    box-sizing: border-box;
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h3 {
    color: var(--text-color);
    transition: color 0.3s ease;
}

h3 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

#share-button {
    background-color: #2196F3;
}

#share-button:hover {
    background-color: #0b7dda;
}

.winners-list {
    text-align: left;
    margin: 10px 0;
    height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 4px;
    background-color: var(--winners-bg);
    transition: background-color 0.3s ease;
}

.winner-item {
    padding: 8px 5px;
    border-bottom: 1px dashed var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.winner-item:last-child {
    border-bottom: none;
}

.winner-name {
    font-weight: bold;
    color: var(--text-color);
}

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

.secondary-button {
    background-color: #f44336;
    padding: 8px 16px;
    font-size: 14px;
    margin-top: 10px;
}

.secondary-button:hover {
    background-color: #d32f2f;
}

.wheel-options {
    margin: 15px 0;
    font-size: 14px;
    display: flex;
    justify-content: center;
    background-color: var(--wheel-options-bg);
    padding: 10px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.wheel-options label {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--text-color);
}

.wheel-options input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

/* Tema switch */
.theme-switch {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
}

.theme-switch-label {
    display: inline-block;
    height: 26px;
    position: relative;
    width: 50px;
    margin-left: 8px;
}

.theme-switch-label input {
    opacity: 0;
    width: 0;
    height: 0;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* Responsividade para dispositivos móveis */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        padding: 0;
    }
    
    .wheel-section, .right-section {
        flex: 1 1 auto;
        width: 100%;
        max-width: 100%;
        padding: 15px;
        box-sizing: border-box;
    }
    
    .wheel-container {
        max-width: 350px;
    }
    
    button {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    h1 {
        font-size: 24px;
        margin-right: 60px; /* Espaço para o switch de tema */
    }
    
    .theme-switch {
        top: 15px;
        right: 15px;
    }
}

@media (max-width: 480px) {
    .wheel-container {
        max-width: 280px;
    }
    
    body {
        padding: 5px;
    }
    
    .wheel-section, .right-section, .names-section, .winners-section {
        padding: 10px;
    }
    
    button {
        padding: 8px 16px;
        font-size: 13px;
        margin: 3px;
    }
}

.print-icon {
    cursor: pointer;
    font-size: 1.1em;
    margin-left: 10px;
    transition: opacity 0.3s;
}

.print-icon:hover {
    opacity: 0.7;
}

/* Estilos específicos para impressão */
@media print {
    body * {
        visibility: hidden;
    }
    
    .winners-list, .winners-list * {
        visibility: visible;
    }
    
    .winners-list {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: auto;
        overflow: visible;
        background: white !important;
        color: black !important;
        border: none;
        padding: 20px;
        box-sizing: border-box;
    }
    
    .winner-item {
        color: black !important;
        border-bottom-color: #ccc !important;
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: 10px 0;
        page-break-inside: avoid;
    }
    
    .winner-name {
        color: black !important;
        margin-right: 20px;
    }
    
    .winner-time {
        color: black !important;
        white-space: nowrap;
        overflow: visible;
    }
    
    /* Adicionar título para a impressão */
    .winners-list::before {
        content: "Lista de Ganhadores";
        display: block;
        font-size: 24px;
        font-weight: bold;
        margin-bottom: 20px;
        text-align: center;
    }
}