/* CSS Variables - Modern Dark Mode with Vibrant Accents */
:root {
    /* Primary: Electric Teal (same as budget-tracker) */
    --primary: #00d4aa;
    --primary-dark: #00b894;
    --primary-light: #55efc4;

    /* Secondary: Purple accent for conference theme */
    --secondary: #a855f7;
    --secondary-dark: #9333ea;

    /* Danger: Vibrant Coral-Pink */
    --danger: #ff6b9d;
    --danger-dark: #e84a7f;

    /* Success: Bright Mint */
    --success: #00e676;

    /* Warning: Soft Gold */
    --warning: #ffc048;

    /* Dark mode grays */
    --gray-900: #0f0f12;
    --gray-800: #16161a;
    --gray-700: #1e1e24;
    --gray-600: #2a2a32;
    --gray-500: #4a4a56;
    --gray-400: #72728a;
    --gray-300: #a0a0b8;
    --gray-200: #ccccd8;
    --gray-100: #e8e8f0;
    --gray-50: #f4f4f8;
    --white: #ffffff;

    /* Shadows */
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);

    /* Glow effects */
    --glow-primary: 0 0 20px rgba(0, 212, 170, 0.3);

    /* Radii */
    --radius: 8px;
    --radius-lg: 12px;

    /* Layout */
    --nav-height: 56px;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 18px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--gray-900);
    min-height: 100vh;
    color: var(--gray-200);
    line-height: 1.5;
    overflow-x: hidden;
}

/* App Container */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Login Screen */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--gray-900);
}

.login-container {
    width: 100%;
    max-width: 360px;
    padding: 32px 24px;
    background: var(--gray-800);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.login-container h1 {
    text-align: center;
    color: var(--primary);
    font-size: 1.75rem;
    margin-bottom: 24px;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-form .form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--gray-300);
    font-size: 0.875rem;
}

.login-error {
    background: rgba(255, 107, 157, 0.15);
    color: var(--danger);
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 16px;
    border: 1px solid var(--danger);
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 12px;
    right: 12px;
    background: var(--warning);
    color: var(--gray-900);
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 150;
    box-shadow: var(--shadow-md);
}

/* Main Content */
main {
    flex: 1;
    width: 100%;
    padding-bottom: var(--nav-height);
    overflow-y: auto;
}

/* Screens */
.screen {
    display: none;
    width: 100%;
    padding: 12px;
    min-height: calc(100vh - var(--nav-height));
}

.screen.active {
    display: block;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--gray-800);
    border-top: 1px solid var(--gray-600);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.4);
    z-index: 100;
}

.nav-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 44px;
    padding: 6px 4px;
    color: var(--gray-300);
    text-decoration: none;
    transition: color 0.2s, background-color 0.2s;
}

.nav-item svg {
    width: 22px;
    height: 22px;
    margin-bottom: 1px;
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 500;
}

.nav-item.active {
    color: var(--primary);
    background: rgba(0, 212, 170, 0.1);
    border-radius: var(--radius);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
    box-shadow: var(--glow-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    -webkit-user-select: none;
    user-select: none;
}

.btn:active {
    transform: scale(0.98);
}

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

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-600);
}

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

.btn-danger:hover:not(:disabled) {
    background: var(--danger-dark);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover:not(:disabled) {
    background: rgba(0, 212, 170, 0.1);
}

.btn-icon {
    min-width: 48px;
    min-height: 48px;
    padding: 12px;
    background: transparent;
    border-radius: 50%;
    color: var(--gray-200);
}

.btn-icon:hover {
    background: var(--gray-700);
}

.btn-block {
    width: 100%;
}

.btn-small {
    min-height: 36px;
    padding: 8px 16px;
    font-size: 0.875rem;
}

/* Inputs */
.input, .select, .textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid var(--gray-600);
    border-radius: var(--radius);
    background: var(--gray-800);
    color: var(--gray-100);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.2);
}

.textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

.textarea-large {
    min-height: 200px;
}

/* Form Groups */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-400);
}

/* Schedule Screen */
.schedule-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 12px;
}

.schedule-header h1 {
    font-size: 1.25rem;
    color: var(--gray-100);
}

.schedule-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-select {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 0.875rem;
}

#events-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.date-group {
    background: var(--gray-800);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-700);
}

.date-header {
    padding: 12px 16px;
    background: var(--gray-700);
    border-bottom: 1px solid var(--gray-600);
}

.date-header-date {
    font-weight: 600;
    color: var(--gray-100);
}

.event-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-700);
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.event-item:active {
    background: var(--gray-700);
}

.event-info {
    flex: 1;
    min-width: 0;
}

.event-title {
    font-weight: 500;
    color: var(--gray-100);
    margin-bottom: 4px;
}

.event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--gray-400);
}

.event-time {
    color: var(--primary);
}

.event-location {
    color: var(--gray-400);
}

.event-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.tag-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--secondary);
    color: var(--white);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.note-indicator {
    margin-left: 6px;
}

.event-arrow {
    color: var(--gray-500);
    margin-left: 12px;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-500);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Event Detail Screen */
.event-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.event-header h1 {
    flex: 1;
    font-size: 1.25rem;
    color: var(--gray-100);
}

.event-details {
    background: var(--gray-800);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-700);
}

#event-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-100);
    margin-bottom: 8px;
}

#event-datetime {
    color: var(--primary);
    margin-bottom: 6px;
}

#event-location {
    color: var(--gray-400);
    margin-bottom: 6px;
}

#event-description {
    color: var(--gray-300);
    font-size: 0.9rem;
    white-space: pre-wrap;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-700);
}

/* Notes Section */
.notes-section {
    background: var(--gray-800);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-700);
}

.notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.notes-header h2 {
    font-size: 1rem;
    color: var(--gray-100);
}

.notes-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.save-status {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
}

.save-status.saved {
    background: rgba(0, 230, 118, 0.15);
    color: var(--success);
}

.save-status.saving {
    background: rgba(255, 192, 72, 0.15);
    color: var(--warning);
}

.save-status.unsaved {
    background: rgba(255, 107, 157, 0.15);
    color: var(--danger);
}

.save-status.error {
    background: var(--danger);
    color: var(--white);
}

#note-editor {
    width: 100%;
    min-height: 250px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
}

#note-preview {
    min-height: 250px;
    padding: 12px;
    background: var(--gray-700);
    border-radius: var(--radius);
    color: var(--gray-200);
    overflow-y: auto;
}

#note-preview h1, #note-preview h2, #note-preview h3 {
    color: var(--gray-100);
    margin: 1em 0 0.5em;
}

#note-preview h1:first-child, #note-preview h2:first-child, #note-preview h3:first-child {
    margin-top: 0;
}

#note-preview p {
    margin: 0.5em 0;
}

#note-preview ul, #note-preview ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

#note-preview code {
    background: var(--gray-600);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

#note-preview pre {
    background: var(--gray-600);
    padding: 12px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 0.5em 0;
}

#note-preview pre code {
    background: none;
    padding: 0;
}

#note-preview blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 12px;
    margin: 0.5em 0;
    color: var(--gray-400);
}

#note-preview a {
    color: var(--primary);
}

/* Tags Section */
.tags-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-700);
}

.tags-section h3 {
    font-size: 0.875rem;
    color: var(--gray-400);
    margin-bottom: 8px;
}

#tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px 4px 12px;
    background: var(--secondary);
    color: var(--white);
    border-radius: 16px;
    font-size: 0.875rem;
}

.tag-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    background: rgba(0, 0, 0, 0.2);
    color: var(--white);
    cursor: pointer;
    border-radius: 50%;
    padding: 0;
}

.tag-remove:hover {
    background: rgba(0, 0, 0, 0.4);
}

#tag-input {
    min-height: 40px;
    padding: 8px 12px;
}

/* Event Actions */
.event-actions {
    margin-top: 16px;
}

/* Add Event 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;
    padding: 16px;
    z-index: 200;
}

.modal {
    background: var(--gray-800);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-700);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--gray-700);
}

.modal-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-100);
}

.modal-body {
    padding: 16px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid var(--gray-700);
}

.modal-footer .btn {
    flex: 1;
}

/* Parsed Preview */
.parsed-preview {
    background: var(--gray-700);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 16px;
}

.parsed-preview h3 {
    font-size: 0.875rem;
    color: var(--gray-400);
    margin-bottom: 12px;
}

.parsed-preview .form-group {
    margin-bottom: 12px;
}

.parsed-preview .input {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 0.9rem;
}

/* Settings Screen */
.settings-section {
    background: var(--gray-800);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-700);
}

.settings-section h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-100);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-600);
}

#sync-status {
    color: var(--gray-400);
    font-size: 0.875rem;
    margin-bottom: 12px;
}

#all-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.empty-tags {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.user-email {
    color: var(--gray-400);
    font-size: 0.875rem;
    margin-bottom: 12px;
}

.file-input-label {
    cursor: pointer;
}

.file-input-label input {
    display: none;
}

/* Toast */
.toast {
    position: fixed;
    bottom: calc(var(--nav-height) + 16px);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--gray-700);
    color: var(--gray-100);
    padding: 12px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-600);
    z-index: 300;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

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

.toast.success {
    background: var(--success);
    color: var(--gray-900);
}

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

/* Utilities */
.hidden {
    display: none !important;
}

/* Responsive */
@media (min-width: 900px) {
    main {
        max-width: 800px;
        margin: 0 auto;
    }

    .bottom-nav {
        max-width: 800px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
}

/* Safe area insets */
@supports (padding: max(0px)) {
    main {
        padding-top: max(12px, env(safe-area-inset-top));
    }

    .bottom-nav {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
        height: calc(var(--nav-height) + max(0px, env(safe-area-inset-bottom)));
    }

    main {
        padding-bottom: calc(var(--nav-height) + max(0px, env(safe-area-inset-bottom)));
    }
}

/* Conference/Archive Styles */
.conference-card {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--gray-800);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-700);
    cursor: pointer;
    transition: background-color 0.2s;
}

.conference-card:active {
    background: var(--gray-700);
}

.conference-info {
    flex: 1;
    min-width: 0;
}

.conference-name {
    font-weight: 600;
    color: var(--gray-100);
    margin-bottom: 4px;
}

.conference-meta {
    display: flex;
    gap: 12px;
    font-size: 0.875rem;
    color: var(--gray-400);
}

.notes-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 2px 10px;
    background: var(--secondary);
    color: var(--white);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Note indicator icon */
.note-indicator-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary);
    margin-right: 8px;
    flex-shrink: 0;
}

.event-title.has-notes {
    color: var(--secondary);
}

/* Conference header with edit button */
.event-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.event-header h1 {
    flex: 1;
    font-size: 1.125rem;
    color: var(--gray-100);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#edit-conference-btn {
    flex-shrink: 0;
}

/* Conference URL Link */
.conference-url-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin-bottom: 16px;
    background: var(--gray-700);
    border-radius: var(--radius);
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.conference-url-link:hover {
    background: var(--gray-600);
}

.conference-url-link svg {
    flex-shrink: 0;
}

/* Active Conference Links on Schedule Screen */
.active-conference-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.active-conference-link {
    flex: 1 1 auto;
    min-width: 0;
    padding: 10px 14px;
    background: var(--gray-800);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color 0.2s;
}

.active-conference-link:hover {
    background: rgba(0, 212, 170, 0.1);
}

/* Conference list in modal */
.conference-list-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--gray-700);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.conference-list-item:hover {
    background: var(--gray-600);
}

.conference-list-item:last-child {
    margin-bottom: 0;
}

.conference-list-info {
    flex: 1;
    min-width: 0;
}

.conference-list-name {
    font-weight: 500;
    color: var(--gray-100);
    margin-bottom: 2px;
}

.conference-list-dates {
    font-size: 0.875rem;
    color: var(--gray-400);
}

/* Date input styling */
input[type="date"] {
    color-scheme: dark;
}

/* Conference edit modal footer */
.conference-edit-footer {
    display: flex;
    gap: 12px;
}

.conference-edit-footer .btn-danger {
    flex: 0 0 auto;
}

.conference-edit-footer .btn-primary {
    flex: 1;
}

/* Select dropdown styling */
.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
