/* How to run: Link this file in index.html with <link rel="stylesheet" href="styles.css"> */

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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
    padding: 20px;
}

#app {
    width: 100%;
    max-width: 1400px;
}

.screen {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: block;
}

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

/* ============ CREATOR SCREEN ============ */
.creator-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.creator-container h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2.5em;
}

.creator-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 30px;
    align-items: start;
}

.preview-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-section h2 {
    color: #667eea;
    margin-bottom: 15px;
}

#previewCanvas {
    border: 3px solid #667eea;
    border-radius: 15px;
    background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    margin-bottom: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    cursor: grab;
}

#previewCanvas:active {
    cursor: grabbing;
}

.preview-controls {
    text-align: center;
    font-size: 0.85em;
    color: #667eea;
    margin-bottom: 15px;
    font-style: italic;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.options-section {
    max-height: 700px;
    overflow-y: auto;
    padding-right: 10px;
}

.options-section h2 {
    color: #667eea;
    margin-bottom: 15px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: #999;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-content {
    display: none;
}

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

.option-group {
    margin-bottom: 15px;
}

.option-group label {
    display: block;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.option-group select,
.option-group input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.9em;
    transition: border-color 0.3s;
}

.option-group select:focus,
.option-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* Saved Characters List */
.saved-characters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
}

.character-item {
    background: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.character-item:hover {
    border-color: #667eea;
    background: #f9f9ff;
}

.character-item-name {
    font-weight: bold;
    color: #333;
}

.character-item-date {
    font-size: 0.8em;
    color: #999;
    margin-top: 3px;
}

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

.char-btn-small {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.3s;
}

.char-btn-load {
    background: #667eea;
    color: white;
}

.char-btn-load:hover {
    background: #5568d3;
}

.char-btn-delete {
    background: #ff6b6b;
    color: white;
}

.char-btn-delete:hover {
    background: #ff5252;
}

/* ============ BUTTONS ============ */
.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #667eea;
    border: 2px solid #667eea;
    width: 100%;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

/* ============ MODAL ============ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-in;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    min-width: 300px;
}

.modal-content h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.modal-content input:focus {
    outline: none;
    border-color: #667eea;
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

.modal-buttons button {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-buttons .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-buttons .btn-primary:hover {
    transform: translateY(-2px);
}

.modal-buttons .btn-secondary {
    background: #f0f0f0;
    color: #667eea;
    border: 2px solid #667eea;
}

.modal-buttons .btn-secondary:hover {
    background: #667eea;
    color: white;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    .creator-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    #previewCanvas {
        width: 100%;
        height: auto;
    }

    .options-section {
        max-height: 500px;
    }
}

@media (max-width: 600px) {
    .creator-container {
        padding: 15px;
    }

    .creator-container h1 {
        font-size: 1.8em;
    }

    .tabs {
        flex-direction: column;
    }

    .tab-btn {
        border-bottom: none;
        border-left: 3px solid transparent;
    }

    .tab-btn.active {
        border-bottom: none;
        border-left-color: #667eea;
    }
}