/* Milkinside-inspired Design System - Clean, minimal, light theme */

:root {
    /* Light palette - soft grays and whites */
    --bg-page: #f5f7fa;
    --bg-card: #ffffff;
    --bg-card-hover: #fafbfc;
    --bg-input: #f3f4f6;
    --bg-input-focus: #ffffff;
    
    /* Borders */
    --border-light: #e5e7eb;
    --border-medium: #d1d5db;
    
    /* Text */
    --text-primary: #374151;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-white: #ffffff;
    
    /* Sidebar - soft slate blue to complement light theme */
    --sidebar-bg: #4f6b8a;
    --sidebar-hover: #5d7a9a;
    --sidebar-active: #6b8aaa;
    --sidebar-border: rgba(255, 255, 255, 0.15);
    
    /* Primary CTA - orange-to-pink gradient (Milkinside style) */
    --gradient-primary: linear-gradient(135deg, #f97316 0%, #ec4899 100%);
    --gradient-primary-hover: linear-gradient(135deg, #fb923c 0%, #f472b6 100%);
    
    /* Accent colors */
    --accent-blue: #3b82f6;
    --accent-blue-light: #60a5fa;
    --accent-green: #22c55e;
    --accent-green-light: #4ade80;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    
    /* Shadows - soft, diffuse */
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
    --shadow-card-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
    --shadow-button: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Page background - soft light gray gradient */
body {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
    background-attachment: fixed;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    color: var(--text-primary);
    position: relative;
    overflow-x: hidden;
}

body > .flex {
    position: relative;
    z-index: 1;
}

/* Z-index management */
aside,
aside[style*="z-index: 9999"] {
    z-index: 10 !important;
}

#timer-widget,
#timer-bar-indicator {
    z-index: 50 !important;
}

/* Timer dropdown - smooth open/close transition */
#timer-widget {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s;
    transform-origin: top right;
}

#timer-widget.timer-widget-hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: scale(0.98);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s 0.2s;
}

/* Timer dropdown action buttons - smooth opacity when swapping */
#timer-widget-stop,
#timer-widget-resume,
#timer-widget-convert {
    transition: opacity 0.15s ease;
}

/* Prevent layout jump when Stop/Resume swap */
#timer-widget-actions {
    min-height: 36px;
}

/* Timer pills in top bar - prominent shadow and border for visibility */
.timer-bar-item {
    background: white !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08) !important;
    transition: transform 0.2s ease-out, box-shadow 0.2s ease;
}

/* Ensure running timer lightning icon is visible */
.timer-bar-item [data-timer-runner] {
    color: #16a34a;
    flex-shrink: 0;
}

.timer-bar-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

body:has(#timer-shortcut-modal:not(.hidden)) aside,
body:has(#timer-shortcut-modal:not(.hidden)) #timer-widget,
body:has(#timer-shortcut-modal:not(.hidden)) #timer-bar-indicator {
    z-index: 1 !important;
}

/* Sidebar - solid soft slate blue, no glass */
aside {
    background: var(--sidebar-bg) !important;
    border-right: 1px solid var(--sidebar-border) !important;
    box-shadow: var(--shadow-card-hover);
    position: relative;
    z-index: 10 !important;
}

aside.sidebar-overlay.sidebar-bg-overlay {
    background: var(--sidebar-bg) !important;
    opacity: 1 !important;
}

aside.sidebar-overlay.sidebar-bg-desktop {
    background: var(--sidebar-bg) !important;
}

/* Sidebar subtle edge */
aside::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 100%);
    pointer-events: none;
}

aside .border-b,
aside .border-t {
    border-color: var(--sidebar-border) !important;
}

/* Sidebar nav links - avoid transition:all to prevent jerky icon movement on collapse */
aside nav a {
    transition: background-color 0.2s ease, border-color 0.2s ease;
    border-radius: 12px;
    margin: 6px 0;
    background: rgba(255, 255, 255, 0.1) !important;
    border: none !important;
}

aside nav a:hover {
    background: var(--sidebar-hover) !important;
}

aside nav a.bg-blue-500 {
    background: linear-gradient(135deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.12) 100%) !important;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.2), 0 2px 8px rgba(0,0,0,0.15) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
}

aside .text-blue-200 {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Main content */
main {
    padding: 2.5rem;
    position: relative;
    z-index: 1;
}

/* Cards - solid white, soft shadow */
.bg-white {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-light) !important;
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.bg-white::before {
    display: none;
}

.bg-white:hover {
    box-shadow: var(--shadow-card-hover);
    background: var(--bg-card) !important;
}

/* Rounded corners */
.rounded-lg {
    border-radius: 16px !important;
}

.rounded-md {
    border-radius: 12px !important;
}

.rounded-xl {
    border-radius: 20px !important;
}

/* Buttons - base styles */
button,
a.bg-blue-600,
a.bg-green-600,
a.bg-red-600,
a.bg-orange-600 {
    transition: all 0.2s ease;
    border: none;
    border-radius: 12px !important;
    font-weight: 600;
    box-shadow: var(--shadow-button);
}

button::before,
a.bg-blue-600::before,
a.bg-green-600::before,
a.bg-red-600::before,
a.bg-orange-600::before {
    display: none;
}

button:hover,
a.bg-blue-600:hover,
a.bg-green-600:hover,
a.bg-red-600:hover,
a.bg-orange-600:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Primary CTA - orange-pink gradient (Log Time, New Project) */
.bg-green-600 {
    background: var(--gradient-primary) !important;
    color: var(--text-white) !important;
}

.bg-green-600:hover {
    background: var(--gradient-primary-hover) !important;
}

/* Blue - View/Edit actions */
.bg-blue-600 {
    background: var(--accent-blue) !important;
    color: var(--text-white) !important;
}

.bg-blue-600:hover {
    background: var(--accent-blue-light) !important;
}

/* Red - destructive */
.bg-red-600 {
    background: var(--accent-red) !important;
    color: var(--text-white) !important;
}

.bg-red-600:hover {
    background: #dc2626 !important;
}

/* Orange - timer, etc */
.bg-orange-600 {
    background: var(--accent-orange) !important;
    color: var(--text-white) !important;
}

.bg-orange-600:hover {
    background: #ea580c !important;
}

/* Form inputs - light gray, clean */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-light) !important;
    border-radius: 12px !important;
    transition: all 0.2s ease;
    color: var(--text-primary) !important;
}

input:focus,
select:focus,
textarea:focus {
    background: var(--bg-input-focus) !important;
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    outline: none;
}

/* Tables - clean, minimal */
table {
    background: transparent !important;
    border: none;
}

thead.bg-gray-50,
thead.bg-gray-200 {
    background: var(--bg-input) !important;
    border-bottom: 1px solid var(--border-light);
}

tbody tr {
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--border-light);
}

tbody tr:hover {
    background: var(--bg-input) !important;
}

/* Timer widget */
#timer-widget > div {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-light) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    border-radius: 16px !important;
}

#timer-widget > div::before {
    display: none;
}


/* Status badges - clean pills */
span.px-2.py-0\.5,
span.px-2.inline-flex {
    border: none;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: none;
}

/* Pagination */
nav.relative.z-0 a,
a.relative.inline-flex {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-light) !important;
    transition: all 0.2s ease;
    border-radius: 10px;
}

nav.relative.z-0 a:hover {
    background: var(--border-light) !important;
}

.bg-blue-50 {
    background: #eff6ff !important;
    border: 1px solid #bfdbfe;
}

/* Subtle animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

main > * {
    animation: fadeIn 0.3s ease;
}

/* Shadows */
.shadow {
    box-shadow: var(--shadow-card) !important;
}

.shadow-lg {
    box-shadow: var(--shadow-card-hover) !important;
}

.shadow-2xl {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1) !important;
}

/* Links */
a.text-blue-600 {
    color: var(--accent-blue) !important;
    transition: color 0.2s ease;
}

a.text-blue-600:hover {
    color: var(--accent-blue-light) !important;
}

/* Header - light, clean */
header {
    background: var(--bg-card) !important;
    border-bottom: 1px solid var(--border-light) !important;
    box-shadow: var(--shadow-card);
}

/* Responsive */
@media (max-width: 768px) {
    main {
        padding: 1.5rem;
    }
}

/* Sidebar overlay modes */
aside.sidebar-overlay.sidebar-bg-overlay {
    background-color: var(--sidebar-bg) !important;
    background: var(--sidebar-bg) !important;
}

aside.sidebar-bg-overlay nav a,
aside.sidebar-bg-desktop nav a {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 1) !important;
}

aside.sidebar-bg-overlay nav a:hover,
aside.sidebar-bg-desktop nav a:hover {
    background-color: var(--sidebar-hover) !important;
}

aside.sidebar-bg-overlay nav a.bg-blue-500,
aside.sidebar-bg-desktop nav a.bg-blue-500 {
    background: linear-gradient(135deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.12) 100%) !important;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.2), 0 2px 8px rgba(0,0,0,0.15) !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-input);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

::selection {
    background: rgba(59, 130, 246, 0.2);
    color: var(--text-primary);
}

/* Modal */
#timer-shortcut-modal,
#timer-shortcut-modal.fixed,
#timer-shortcut-modal.inset-0,
div#timer-shortcut-modal,
.modal,
[role="dialog"],
.fixed.inset-0.z-50 {
    z-index: 999999 !important;
    position: fixed !important;
}

#timer-shortcut-modal > div,
#timer-shortcut-modal div.modal-content,
div#timer-shortcut-modal > div,
.modal-content {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-light) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border-radius: 16px !important;
}

#timer-shortcut-modal.fixed.inset-0,
div#timer-shortcut-modal.fixed.inset-0 {
    background: rgba(0, 0, 0, 0.4) !important;
}
