:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-light: #f1f5f9;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(0, 0, 0, 0.08);
    --text-main: #1e293b;
    --text-dim: #64748b;
    --accent-red: #ef4444;
    --accent-green: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    padding: 2rem;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    filter: blur(80px);
}

.blob {
    position: absolute;
    border-radius: 50%;
    opacity: 0.4;
    transition: all 0.5s ease;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    right: -100px;
    animation: move 20s infinite alternate;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: #ec4899;
    bottom: -50px;
    left: -50px;
    animation: move 25s infinite alternate-reverse;
}

@keyframes move {
    from {
        transform: translate(0, 0);
    }

    to {
        transform: translate(50px, 50px);
    }
}

.app-container {
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text-main) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-dim);
    font-size: 1.1rem;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.controls {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
    justify-content: center;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
}

.input-group label {
    font-size: 0.9rem;
    color: var(--text-dim);
    font-weight: 600;
}

input {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.8rem 2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    height: 48px;
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.primary-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 10px;
    padding: 0.5rem 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.secondary-btn:hover {
    background: var(--primary);
    color: white;
}

/* Tables Grid */
.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.table-card {
    position: relative;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.table-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-name {
    font-size: 1.4rem;
    font-weight: 800;
}

.delete-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 5px;
    font-size: 1.2rem;
    transition: color 0.3s;
}

.delete-btn:hover {
    color: var(--accent-red);
}

.timer-display {
    font-family: 'Outfit', monospace;
    font-size: 3rem;
    font-weight: 800;
    text-align: center;
    margin: 0.5rem 0;
    background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.timer-display.expired {
    background: linear-gradient(135deg, #ff4e50 0%, #f9d423 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.card-footer {
    display: flex;
    gap: 1rem;
}

.footer-btn {
    flex: 1;
    padding: 0.6rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.footer-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.reset-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.stop-btn {
    color: var(--accent-red);
}

.stop-btn:hover {
    border-color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
}

.turnover-hint {
    text-align: center;
    font-size: 0.8rem;
    color: var(--accent-red);
    font-weight: 600;
    margin-top: -0.5rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-5px);
    }

    60% {
        transform: translateY(-3px);
    }
}

.table-card.expired {
    cursor: pointer;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Responsive */
@media (max-width: 1024px) {
    .tables-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .controls {
        padding: 1.5rem;
        gap: 1rem;
    }

    .input-group {
        min-width: 100%;
    }

    .primary-btn {
        width: 100%;
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.75rem;
    }

    .table-card {
        padding: 1.25rem;
    }

    .timer-display {
        font-size: 2.5rem;
    }

    /* Larger touch targets for mobile */
    .footer-btn,
    .primary-btn {
        min-height: 54px;
        font-size: 1.1rem;
    }

    .delete-btn {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    max-width: 400px;
    width: 90%;
    text-align: center;
    padding: 2.5rem;
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.modal-content h2 {
    margin-bottom: 0.5rem;
    color: var(--accent-red);
}

.modal-content p {
    color: var(--text-dim);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-actions .secondary-btn {
    margin-top: 0;
}