/* Animations and Transitions */
:root {
    --panel-transition-duration: 300ms;
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --panel-transition-duration: 0ms;
    }
    * {
        animation-duration: 0ms !important;
        transition-duration: 0ms !important;
    }
}

/* Glassmorphism Styles */
.glass-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.glass-card-inner {
    background: rgba(15, 22, 35, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.glass-input {
    background: rgba(15, 22, 35, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-input:focus {
    background: rgba(15, 22, 35, 0.8);
    border-color: rgba(72, 191, 145, 0.5);
    box-shadow: 0 0 0 3px rgba(72, 191, 145, 0.1);
}

.glass-header {
    background: rgba(15, 22, 35, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.glass-nav {
    background: rgba(15, 22, 35, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Panel System */
.panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateX(100%);
    opacity: 0;
    transition: transform var(--panel-transition-duration) ease-in-out,
                opacity var(--panel-transition-duration) ease-in-out;
    pointer-events: none;
}

.panel-active {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.panel-content {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* Navigation Buttons */
.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6B7C7B;
    transition: color 200ms ease, transform 150ms ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.nav-btn svg {
    transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-btn:active {
    transform: scale(0.95);
}

.nav-active {
    color: #48BF91;
}

.nav-active svg {
    transform: scale(1.1);
}

/* Active indicator bar */
.nav-active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: #48BF91;
    border-radius: 0 0 3px 3px;
}

/* Safe Area Support */
.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom);
}

/* Navigation Bar Auto-hide on Scroll */
nav.fixed {
    transition: transform 300ms ease-in-out;
}

nav.nav-hidden {
    transform: translateY(100%);
}

@media (prefers-reduced-motion: reduce) {
    nav.fixed {
        transition: none;
    }
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(72, 191, 145, 0.95);
    color: #0f1623;
    padding: 12px 24px;
    border-radius: 1rem;
    opacity: 0;
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1), opacity 300ms ease;
    z-index: 1000;
    max-width: 90%;
    text-align: center;
    pointer-events: none;
    box-shadow: 0 0 20px rgba(72, 191, 145, 0.4);
    backdrop-filter: blur(4px);
    font-weight: 500;
}

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

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 200ms;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: rgba(30, 41, 59, 0.95);
    border-radius: 1.5rem;
    padding: 24px;
    max-width: 90%;
    width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
}

/* Collapsible Sections */
.collapsible-header {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 200ms ease;
    border-radius: 0.75rem;
    margin: -4px;
    padding: 4px;
}

.collapsible-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.collapsible-content.expanded {
    max-height: 2000px;
}

/* Chevron icon transitions */
.collapse-icon,
.collapse-icon-ex {
    transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Session and Exercise Cards */
.session-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.25rem;
    padding: 16px;
    margin-bottom: 12px;
    transition: box-shadow 200ms, background-color 200ms;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(12px);
}

.session-card:has(.collapsible-content.expanded) {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    background: rgba(30, 41, 59, 0.8);
}

.exercise-card {
    background: rgba(15, 22, 35, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    padding: 12px;
    margin-top: 8px;
}

.entry-item {
    background: rgba(15, 22, 35, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
    padding: 8px 12px;
    margin-top: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Button Styles */
button:active {
    opacity: 0.8;
}

/* Improve tap targets for mobile */
button, a, input[type="checkbox"] {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
}

/* Input Focus States */
input:focus, select:focus, textarea:focus {
    outline: none;
}

/* Checkbox styling for dark theme */
input[type="checkbox"] {
    accent-color: #48BF91; /* accent color from design system */
}

/* Select element styling for dark theme 
   Note: SVG arrow color #6B7C7B matches 'muted' from design system */
select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236B7C7B' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

select option {
    background: #1a2332; /* surface.DEFAULT from design system */
    color: white;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Hide Number Input Arrows on Mobile */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Selection Checkboxes */
.entry-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Action Buttons Container */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 6px 12px;
    border-radius: 0.5rem;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
    touch-action: manipulation;
}

/* Utility Classes */
.truncate-2-lines {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Notes indicator badge */
.notes-indicator {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: #48BF91;
    border-radius: 50%;
    animation: pulse-note 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-note {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

@media (prefers-reduced-motion: reduce) {
    .notes-indicator {
        animation: none;
    }
    @keyframes fadeIn {
        from, to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Program Cards */
.program-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.25rem;
    padding: 16px;
    transition: box-shadow 200ms, background-color 200ms, transform 150ms;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(12px);
}

.program-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    transform: translateY(-1px);
    background: rgba(30, 41, 59, 0.8);
}

.program-card:active {
    transform: translateY(0);
}

/* Program Day Card (detail view) */
.program-day-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.25rem;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(12px);
}

/* Program Day Editor */
.program-day-editor {
    transition: box-shadow 200ms;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
}

.program-day-editor:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Drag handle styling */
.drag-handle,
.exercise-drag-handle {
    touch-action: none;
    user-select: none;
}

.drag-handle:active,
.exercise-drag-handle:active {
    cursor: grabbing;
}

/* Dragging state */
.dragging {
    opacity: 0.5;
    background: rgba(72, 191, 145, 0.1) !important;
}

.drag-over {
    border: 2px dashed #48BF91;
}
