/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --secondary-color: #f0f9ff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-color: #ffffff;
    --card-bg: #f9fafb;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --transition: all 0.2s ease;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #111827;
        --card-bg: #1f2937;
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --border-color: #374151;
        --secondary-color: #1e3a8a;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    height: 100vh;
    height: 100dvh;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-width: 768px;
    margin: 0 auto;
    position: relative;
}

/* Header Styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.sync-button {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.sync-button:hover,
.sync-button:active {
    background-color: var(--card-bg);
    transform: scale(1.05);
}

/* Main Content */
.main {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    padding-bottom: 3rem;
}

/* Record Button Section */
.record-section {
    padding: 2rem 1rem;
    display: flex;
    justify-content: center;
}

.record-button {
    width: min(280px, 80vw);
    height: min(280px, 80vw);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    position: relative;
    touch-action: manipulation;
}

.record-button:active {
    transform: scale(0.95);
    box-shadow: var(--shadow-md);
}

.button-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.button-icon {
    font-size: 3.5rem;
}

.button-text {
    font-size: 1.5rem;
}

.today-count {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
}

/* Tabs Section */
.tabs-section {
    padding: 0 1rem 1rem;
    position: relative;
}

.tabs-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tabs-scroll {
    flex: 1;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    display: flex;
    gap: 0.25rem;
    padding: 0.25rem;
}

.tabs-scroll::-webkit-scrollbar {
    display: none;
}

.tab {
    flex-shrink: 0;
    padding: 0.75rem 1.25rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    min-width: 5rem;
    text-align: center;
    font-weight: 500;
    position: relative;
}

.tab:hover {
    background-color: var(--bg-color);
}

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

.tab-count {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    background-color: var(--success-color);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    opacity: 0.9;
    transition: var(--transition);
}

.scroll-button:hover {
    background-color: var(--card-bg);
    opacity: 1;
}

.scroll-button.left {
    left: 0;
}

.scroll-button.right {
    right: 0;
}

/* Kicks List Section */
.kicks-section {
    padding: 1rem;
}

.date-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.date-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.day-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.kicks-container {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.kicks-list {
    list-style: none;
    max-height: 50vh;
    overflow-y: auto;
}

.kick-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.kick-item:last-child {
    border-bottom: none;
}

.kick-item:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

@media (prefers-color-scheme: dark) {
    .kick-item:hover {
        background-color: rgba(255, 255, 255, 0.02);
    }
}

.kick-number {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary-color);
    min-width: 2.5rem;
}

.kick-time {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 1.25rem;
    font-weight: 500;
    text-align: right;
}

.empty-state {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-text {
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.empty-subtext {
    font-size: 0.875rem;
    opacity: 0.75;
}

/* Status Bar */
.status-bar {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-color);
    border-top: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.status-info {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.status-icon {
    color: var(--success-color);
    font-size: 0.75rem;
}

.status-info.offline .status-icon {
    color: var(--warning-color);
}

.last-updated {
    font-size: 0.75rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 4.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-weight: 500;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 1001;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Responsive Adjustments */
@media (max-width: 640px) {
    .record-button {
        width: min(240px, 80vw);
        height: min(240px, 80vw);
    }
    
    .button-icon {
        font-size: 2.5rem;
    }
    
    .button-text {
        font-size: 1.25rem;
    }
    
    .scroll-button {
        display: none;
    }
}

/* Haptic Feedback Animation */
@keyframes haptic {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
}

.record-button:active {
    animation: haptic 0.2s ease;
}

/* Pulse animation for new kicks */
@keyframes pulse {
    0% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(79, 70, 229, 0.1);
    }
    100% {
        background-color: transparent;
    }
}

.kick-item.new {
    animation: pulse 1s ease;
}

#delete-today-button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

#delete-today-button:hover {
  background-color: #c82333 !important;
}

#delete-today-button:active {
  background-color: #bd2130 !important;
}
