/* style.css */

:root {
    --primary-color: #ff6b6b;
    --primary-hover: #ff5252;
    --secondary-color: #4ecdc4;
    --secondary-hover: #3db8b0;
    --dark-color: #2d3436;
    --light-color: #f9f9f9;
    --white: #ffffff;
    --gray-light: #f1f2f6;
    --gray-dark: #747d8c;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --border-radius: 16px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Noto Sans TC', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--dark-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

header {
    text-align: center;
    margin-bottom: 10px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--primary-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.05);
}

header h1 i {
    animation: pulse 2s infinite;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--gray-dark);
    font-weight: 500;
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Card Styling */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
}

/* Selector Card */
.selector-card {
    justify-content: center;
    align-items: center;
    text-align: center;
    background: linear-gradient(to bottom, #ffffff, #fffdfa);
}

.display-container {
    width: 100%;
    min-height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--gray-light);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 30px;
    border: 3px dashed #dfe4ea;
    overflow: hidden;
    position: relative;
}

.roll-display {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-color);
    transition: transform 0.1s ease;
    word-break: break-all;
}

.roll-display.rolling {
    animation: rollSkew 0.15s infinite alternate;
    color: var(--primary-color);
}

.roll-display.selected {
    font-size: 2.4rem;
    font-weight: 900;
    color: #ff4757;
    animation: celebrate 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Buttons */
.btn {
    font-family: inherit;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    outline: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: scale(1.03);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.25rem;
    width: 100%;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--white);
    padding: 10px 18px;
    font-size: 0.95rem;
}

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

.btn-text {
    background: transparent;
    color: var(--gray-dark);
    font-size: 0.9rem;
    padding: 5px 10px;
}

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

/* Options Card */
.options-card h2 {
    font-size: 1.4rem;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--dark-color);
}

.card-desc {
    font-size: 0.9rem;
    color: var(--gray-dark);
    margin-bottom: 20px;
}

.add-food-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.add-food-form input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #dfe4ea;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

.add-food-form input:focus {
    border-color: var(--secondary-color);
}

.options-list-container {
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding-right: 5px;
}

/* Custom scrollbar for options list */
.options-list-container::-webkit-scrollbar {
    width: 6px;
}

.options-list-container::-webkit-scrollbar-track {
    background: var(--gray-light);
    border-radius: 10px;
}

.options-list-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.options-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.options-list li {
    background-color: var(--gray-light);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e4e7eb;
    animation: fadeIn 0.3s ease;
    transition: var(--transition);
}

.options-list li:hover {
    background-color: #ffeaea;
    border-color: #ffcccc;
}

.delete-btn {
    border: none;
    background: transparent;
    color: var(--gray-dark);
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    transition: var(--transition);
}

.delete-btn:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

.reset-container {
    display: flex;
    justify-content: flex-end;
    margin-top: auto;
}

/* Footer styling */
footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--gray-dark);
    margin-top: 10px;
}

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes rollSkew {
    0% {
        transform: scale(0.9) skewX(-2deg);
    }
    100% {
        transform: scale(1.1) skewX(2deg);
    }
}

@keyframes celebrate {
    0% {
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
