@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;900&display=swap');

:root {
    --bg-dark: #0a0a0a;
    --text-main: #f8fafc;
    --text-muted: #9ca3af;
    
    /* Sleek grey gradients */
    --gradient-1: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%);
    --gradient-2: linear-gradient(135deg, #34d399 0%, #059669 100%);
    --gradient-accent: linear-gradient(135deg, #ffffff, #d1d5db, #9ca3af);
    
    --glass-bg: rgba(24, 24, 27, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    
    --slot-bg: rgba(255, 255, 255, 0.03);
    --slot-hover: rgba(255, 255, 255, 0.08);
    
    --accent: #10b981;
    --error: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    overflow-x: hidden;
}

/* Beautiful animated mesh background */
#background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: radial-gradient(circle at 15% 50%, rgba(255, 255, 255, 0.05), transparent 40%),
                radial-gradient(circle at 85% 30%, rgba(255, 255, 255, 0.03), transparent 40%),
                radial-gradient(circle at 50% 80%, rgba(255, 255, 255, 0.02), transparent 40%);
    animation: slowPulse 20s infinite alternate linear;
    filter: blur(60px);
}

@keyframes slowPulse {
    0% { transform: scale(1) translate(0, 0); }
    50% { transform: scale(1.2) translate(5%, -5%); }
    100% { transform: scale(0.9) translate(-5%, 5%); }
}

.app-container {
    width: 100%;
    max-width: 540px;
    position: relative;
    z-index: 1;
    margin: auto;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 40px;
    box-shadow: var(--glass-shadow), inset 0 0 0 1px rgba(255,255,255,0.05);
    display: none;
    opacity: 0;
    transform: translateY(20px) scale(0.98);
}

.glass-panel.active {
    display: block;
    animation: panelEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes panelEnter {
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.logo {
    font-size: 56px;
    text-align: center;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.1));
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

h1 {
    text-align: center;
    font-weight: 900;
    font-size: 36px;
    margin-bottom: 12px;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 32px;
    font-weight: 300;
}

.input-group {
    margin-bottom: 20px;
    position: relative;
}

input {
    width: 100%;
    padding: 18px 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    color: white;
    font-size: 16px;
    transition: all 0.3s ease;
    outline: none;
    font-weight: 500;
}

input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.5);
}

/* Date picker specific */
input[type="date"] {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
}
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) opacity(0.7);
    cursor: pointer;
    transition: 0.2s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
    filter: invert(1) opacity(1);
}

.btn-primary {
    width: 100%;
    padding: 18px;
    background: var(--gradient-1);
    color: #121212;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px rgba(255, 255, 255, 0.1);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 35px rgba(255, 255, 255, 0.2);
}

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

.btn-secondary {
    padding: 18px 24px;
    background: rgba(255,255,255,0.05);
    color: white;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}

.error-msg {
    color: var(--error);
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    min-height: 20px;
    font-weight: 500;
}

.status-msg {
    color: var(--accent);
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    min-height: 20px;
    font-weight: 500;
}

.link {
    color: var(--accent);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: 0.2s;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.3);
    padding-bottom: 2px;
}
.link:hover {
    color: #fff;
    border-bottom-color: #fff;
}

/* Main Screen */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

header h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

header .subtitle {
    text-align: left;
    margin-bottom: 0;
    font-size: 14px;
    color: var(--accent);
    font-weight: 600;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    width: 48px;
    height: 48px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: rotate(5deg) scale(1.1);
}

.tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 16px;
    padding: 6px;
    margin-bottom: 32px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 14px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease forwards;
}

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

.section-block {
    margin-bottom: 32px;
}
.section-block h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-block h3::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    background: var(--gradient-2);
    border-radius: 50%;
}

.instruction {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Grid layout */
.grid-container {
    display: grid;
    grid-template-columns: 55px repeat(7, 1fr);
    gap: 6px;
    overflow-x: auto;
    padding: 4px;
    margin: 0 -4px; /* compensate for padding */
}

/* Custom scrollbar for grid */
.grid-container::-webkit-scrollbar {
    height: 6px;
}
.grid-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
}
.grid-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
}

.grid-cell {
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 13px;
    border-radius: 10px;
    user-select: none;
}

.grid-header {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.grid-time {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    grid-column: 1;
    justify-content: flex-end;
    padding-right: 10px;
}

.slot {
    background: var(--slot-bg);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.slot:hover {
    background: var(--slot-hover);
    transform: scale(1.15);
    z-index: 10;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.slot.selected {
    background: #e5e7eb;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
    color: transparent;
    border: none;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

/* Overlap specific */
.slot-overlap {
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.02);
    transition: all 0.2s ease;
}

.slot-overlap:hover {
    transform: scale(1.15);
    z-index: 10;
    border-color: rgba(255,255,255,0.5);
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 24px;
    background: rgba(0,0,0,0.2);
    padding: 12px 20px;
    border-radius: 12px;
}

.gradient-bar {
    height: 8px;
    flex: 1;
    margin: 0 20px;
    border-radius: 4px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.05), #10b981, #34d399);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.action-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
}

.date-picker-group {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.dates-list {
    list-style: none;
    margin-top: 12px;
}
.dates-list li {
    display: flex;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 8px;
    font-size: 15px;
    font-weight: 500;
    align-items: center;
    border: 1px solid rgba(255,255,255,0.05);
    transition: 0.2s;
}
.dates-list li:hover {
    border-color: rgba(255,255,255,0.1);
    transform: translateX(4px);
}

.dates-list li .remove-btn {
    background: rgba(255, 75, 75, 0.1);
    border: none;
    color: var(--error);
    cursor: pointer;
    font-weight: bold;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.dates-list li .remove-btn:hover {
    background: var(--error);
    color: white;
}

.share-block {
    margin-top: 40px;
    text-align: center;
    padding: 24px;
    background: rgba(0,0,0,0.2);
    border-radius: 16px;
    border: 1px dashed rgba(255,255,255,0.1);
}
.share-block p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 500;
}
.share-block input {
    text-align: center;
    color: #e5e7eb;
    font-weight: 700;
    background: rgba(0,0,0,0.4);
    border-style: solid;
    cursor: pointer;
}
.share-block input:hover {
    border-color: #ffffff;
}

/* Tooltip */
.tooltip {
    position: fixed;
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    pointer-events: none;
    z-index: 100;
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    white-space: pre-wrap;
    border: 1px solid rgba(255, 255, 255, 0.2);
    line-height: 1.5;
    backdrop-filter: blur(10px);
    transform: scale(0.95);
}

.tooltip:not(.hidden) {
    transform: scale(1);
}

.tooltip.hidden {
    opacity: 0;
}

/* Scrollbar for whole page */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

/* Flatpickr Selected Dates Customization */
.flatpickr-day.selected, 
.flatpickr-day.selected:hover,
.flatpickr-day.selected:focus {
    background: var(--error) !important;
    border-color: var(--error) !important;
    color: white !important;
}
