* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 0; /* Mobile nav will handle bottom spacing */
}

.navbar {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links a i {
    font-size: 0.875rem;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1rem;
    padding-bottom: 2rem; /* Default padding, will be overridden on mobile */
}

.footer {
    background-color: var(--surface);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    margin-top: auto;
}

.container {
    background: var(--surface);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

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

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
    min-height: 44px;
    min-width: 44px;
}

.btn:hover {
    background-color: var(--primary-hover);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--secondary-color);
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-danger {
    background-color: var(--error);
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: underline;
    font-size: inherit;
    padding: 0;
    min-height: auto;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    min-height: 36px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
    min-height: 44px;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background-color: var(--surface);
    min-height: 44px;
}

.error-message {
    color: var(--error);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.success-message {
    color: var(--success);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.list {
    list-style: none;
}

.list-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

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

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.records-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .records-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .records-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.category-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

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

/* Record value display on dashboard */
@media (min-width: 768px) {
    .record-value-display {
        text-align: center;
    }
}

@media (max-width: 767px) {
    .record-value-display {
        text-align: left;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .main-content {
        padding: 1rem;
    }

    .container {
        padding: 1.5rem;
    }

    .grid {
        grid-template-columns: 1fr;
    }
    
    .records-grid {
        grid-template-columns: 1fr;
    }
    
    .list-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .list-item > div:last-child {
        display: flex;
        gap: 0.5rem;
        justify-content: flex-start;
        margin-top: 0.75rem;
    }
    
    .date-column-header,
    .date-column-cell {
        display: none;
    }
    
    .date-inline-row {
        display: table-row;
    }
    
    /* Improve card spacing on mobile */
    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .card-title {
        font-size: 1.125rem;
    }
    
    /* Better button sizing on mobile */
    .btn {
        width: 100%;
        padding: 0.875rem 1.25rem;
    }
    
    /* Improve form inputs on mobile */
    .form-input,
    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Better spacing for cards on mobile */
    .card-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    /* Improve button groups on mobile */
    .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Better text sizing on mobile */
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    /* Improve grid layouts on mobile */
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Better modal sizing on mobile */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 1rem auto;
    }
}

@media (min-width: 769px) {
    .date-column-header,
    .date-column-cell {
        display: table-cell;
    }
    
    .date-inline-row {
        display: none;
    }
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.copy-event-btn-subtle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
    opacity: 0.6;
    min-height: auto;
    min-width: auto;
    line-height: 1;
}

.copy-event-btn-subtle:hover {
    opacity: 1;
    background-color: var(--background);
    color: var(--primary-color);
}

.copy-event-btn-subtle:active {
    opacity: 0.8;
}

/* Button Group Styles (Web Awesome fallback/compatibility) */
wa-button-group {
    display: inline-flex;
    vertical-align: middle;
    gap: 0;
    column-gap: 0;
    row-gap: 0;
}

wa-button-group wa-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

wa-button-group wa-button:not(:first-child) {
    border-left: none;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -1px;
}

wa-button-group wa-button:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

