/* Emoji Story Builder Custom Styles */

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --accent-color: #f59e0b;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body {
    background: var(--bg-gradient);
    min-height: 100vh;
    padding: 20px 0;
}

.app-header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.app-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.emoji-panel,
.story-panel,
.saved-stories-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

.panel-header h2 {
    margin: 0;
    color: #1f2937;
    font-size: 1.5rem;
}

/* Search Box */
.search-box {
    position: relative;
    flex: 1;
    max-width: 300px;
    margin-left: 20px;
}

.search-box input {
    padding-right: 40px;
}

.search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    opacity: 0.5;
}

/* Category Tabs */
.category-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 15px;
    scrollbar-width: thin;
}

.category-tabs::-webkit-scrollbar {
    height: 6px;
}

.category-tabs::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.tab {
    padding: 8px 16px;
    background: #f3f4f6;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab:hover {
    background: #e5e7eb;
}

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

/* Emoji Grid */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 8px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 5px;
}

.emoji-grid::-webkit-scrollbar {
    width: 6px;
}

.emoji-grid::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.emoji-item {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: #f8fafc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.emoji-item:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.emoji-item:active {
    transform: scale(0.95);
}

/* Story Panel */
.story-actions {
    display: flex;
    gap: 10px;
}

.story-title-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.story-title {
    flex: 2;
    font-size: 1.1rem;
    font-weight: 500;
}

.story-theme {
    flex: 1;
}

/* Story Canvas */
.story-canvas {
    min-height: 300px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 8px;
    border: 2px dashed #cbd5e1;
    margin-bottom: 20px;
    overflow-y: auto;
    padding: 20px;
    position: relative;
}

.canvas-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #94a3b8;
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.placeholder-text {
    font-size: 1rem;
    line-height: 1.5;
}

/* Selected Emojis */
.selected-emojis {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 60px;
    background: #f8fafc;
    border-radius: 8px;
    padding: 10px;
}

.selected-emoji-item {
    display: flex;
    align-items: center;
    gap: 5px;
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.selected-emoji-item:hover {
    background: #fef3c7;
    border-color: var(--accent-color);
}

.selected-emoji-item .remove-btn {
    width: 20px;
    height: 20px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 5px;
    transition: all 0.2s;
}

.selected-emoji-item .remove-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Stories Grid */
.stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.story-card {
    background: #f8fafc;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.story-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.story-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.story-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.story-card-theme {
    font-size: 0.85rem;
    padding: 3px 10px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    white-space: nowrap;
}

.story-card-panels {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.story-card-panel {
    font-size: 1.5rem;
}

.story-card-meta {
    font-size: 0.85rem;
    color: #64748b;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

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

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: slideDown 0.3s;
}

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

.modal-header {
    padding: 20px;
    border-bottom: 2px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #1f2937;
}

.close-modal {
    background: none;
    border: none;
    font-size: 2rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.close-modal:hover {
    color: #1f2937;
    transform: rotate(90deg);
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px;
    border-top: 2px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Story Viewer */
.story-viewer {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.story-panel {
    font-size: 4rem;
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    min-width: 80px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.story-panel:hover {
    transform: scale(1.05);
    background: #f1f5f9;
}

.story-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 2px solid #e5e7eb;
    font-size: 0.9rem;
    color: #64748b;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    background: #10b981;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
    animation: slideIn 0.3s;
    z-index: 2000;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.error {
    background: #ef4444;
}

.toast.success {
    background: #10b981;
}

.toast.info {
    background: #3b82f6;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .emoji-panel,
    .story-panel {
        margin-bottom: 20px;
    }

    .app-header h1 {
        font-size: 2rem;
    }

    .emoji-grid {
        grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    }

    .emoji-item {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }

    .story-title-section {
        flex-direction: column;
    }

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

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s;
}

.pulse {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
