/* Base Reset & Variables */
:root {
    --bg-color: #f5f5f0;
    /* Warm paper-like off-white */
    --text-color: #1e293b;
    --sidebar-bg: #ffffff;
    --sidebar-border: #e2e8f0;
    --card-bg: #ffffff;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --primary-color: #3b82f6;
    --accent-color: #2563eb;
    --font-family: 'Inter', sans-serif;
    --dialog-bg: #ffffff;
    --dialog-overlay: rgba(0, 0, 0, 0.5);
    --muted-color: #64748b;

    /* Tag variables (Defaults for Light) */
    --tag-sat: 85%;
    --tag-light: 90%;
    --tag-text-light: 30%;
    /* L value for text color */

    --grid-dot-color: #c0c0b8;
    /* Visible warm gray dots */
}

.theme-dark {
    --bg-color: #0f172a;
    --text-color: #f1f5f9;
    --sidebar-bg: #1e293b;
    --sidebar-border: #334155;
    --card-bg: #1e293b;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --primary-color: #60a5fa;
    --accent-color: #93c5fd;
    --dialog-bg: #1e293b;
    --dialog-overlay: rgba(255, 255, 255, 0.1);
    --muted-color: #94a3b8;

    /* Tag variables for Dark */
    --tag-sat: 60%;
    --tag-light: 25%;
    --tag-text-light: 90%;

    --grid-dot-color: rgba(255, 255, 255, 0.08);
    /* Faint white dots */
}

.theme-modern {
    --bg-color: #0d1117;
    /* Very Dark Blue-Grey */
    --text-color: #e6edf3;
    --sidebar-bg: rgba(22, 27, 34, 0.8);
    /* Semi-transparent */
    --sidebar-border: rgba(48, 54, 61, 0.5);
    --card-bg: rgba(22, 27, 34, 0.6);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --primary-color: #2f81f7;
    --accent-color: #79c0ff;
    --dialog-bg: rgba(22, 27, 34, 0.95);
    /* Glassmorphism effects handled in classes */
    --backdrop-blur: blur(10px);
    --muted-color: #8b949e;

    /* Tag variables for Modern */
    --tag-sat: 70%;
    --tag-light: 20%;

    --grid-dot-color: rgba(255, 255, 255, 0.05);
    /* Very faint dots */
    --tag-text-light: 85%;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
    height: 100vh;
    overflow: hidden;
    /* App-like feel */
}

/* Layout */
.app-container {
    display: flex;
    height: 100%;
}

/* Sidebar */
/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-top: 20px;
    transition: background-color 0.3s, border-color 0.3s;
}

.theme-modern .sidebar {
    backdrop-filter: var(--backdrop-blur);
}

.sidebar-icon {
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    color: var(--text-color);
    opacity: 0.7;
    transition: all 0.2s;
}

.sidebar-icon:hover {
    background-color: rgba(128, 128, 128, 0.1);
    opacity: 1;
}

/* Sidebar Filters */
.filters-section {
    padding: 20px;
    width: 100%;
    margin-top: 10px;
    border-top: 1px solid var(--sidebar-border);
}

.filters-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-color);
    margin-bottom: 12px;
    font-weight: 600;
}

.profession-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 80%;
    margin: 0 auto;
}

/**/
.calendar-widget {
    padding: 20px 0;
    /* Removing side padding, controlling via width */
    margin-top: auto;
    /* Push to bottom */
    width: 80%;
    margin-left: auto;
    margin-right: auto;
    border-top: 1px solid var(--sidebar-border);
    position: relative;
    /* Context for tooltip */
}

/* Info Panel Styles */
.calendar-info-panel {
    min-height: 120px;
    padding: 15px;
    /* Adjust padding if needed */
    border-bottom: 1px solid var(--sidebar-border);
    background: var(--bg-color);
    /* Match sidebar bg */
    overflow-y: auto;
    max-height: 200px;
    width: 80%;
    margin: 0 auto;
}

.sidebar-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    padding-left: 20px;
    /* Align with sidebar padding */
    margin-bottom: 20px;
    gap: 15px;
    /* Spacing between icons */
}



.sidebar-icon {
    /* margin-left: 20px; Removed to fix alignment in sidebar-actions */
}

/* Filter Buttons */
.filter-btn {
    cursor: pointer;
    background: none;
    border: 1px solid transparent;
    transition: all 0.2s;
    opacity: 0.6;
    filter: grayscale(100%);
    width: 100%;
    justify-content: flex-start;
}

.filter-btn:hover {
    opacity: 0.8;
    background-color: rgba(128, 128, 128, 0.05);
}

.filter-btn.active {
    opacity: 1;
    filter: grayscale(0%);
    background-color: hsl(var(--tag-hue), var(--tag-sat), var(--tag-light));
    border-color: hsl(var(--tag-hue), var(--tag-sat), 80%);
}

/* iCal Button */
.ical-section {
    margin-top: 20px;
}

.btn-ical {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background-color: transparent;
    border: 1px solid var(--sidebar-border);
    border-radius: 8px;
    color: var(--muted-color);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ical:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: rgba(128, 128, 128, 0.05);
}

.theme-modern .btn-ical:hover {
    background-color: rgba(47, 129, 247, 0.1);
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    max-width: 1800px;
    /* Centered content constraint */
    margin: 0;
    /* Removed auto margin to prevent flex weirdness */
    /* width: 100%; Removed to fix overlap */
    position: relative;
    /* Ensure stacking */
    /* Dotted Grid Background */
    background-color: transparent;
    background-image: radial-gradient(circle, var(--grid-dot-color) 1.5px, transparent 1.6px);
    background-size: 20px 20px;
}

.page-header {
    margin-bottom: 40px;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* Conference Cards */
.conference-list {
    display: grid;
    gap: 20px;
    /* Default: 1 column */
    grid-template-columns: 1fr;
}

@media (min-width: 800px) {
    .conference-list {
        grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    }
}

.conference-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--sidebar-border);
    display: block;
    transition: transform 0.2s, box-shadow 0.2s;
}

.conference-card::after {
    content: "";
    display: table;
    clear: both;
}

.theme-modern .conference-card {
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.conference-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Header tweaks */
.conference-header {
    display: block;
}

.conference-header h3 {
    margin-bottom: 8px;
    font-size: 1.25rem;
    margin-top: 8px;
    /* Added spacing from tags */
}

.conference-header h3 a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s;
}

.conference-header h3 a:hover {
    color: var(--primary-color);
}

/* Profession Tags */
.profession-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}

.profession-tag {
    display: inline-flex;
    /* Use flex for icon alignment */
    align-items: center;
    gap: 4px;
    /* Space between icon and text */
    padding: 3px 10px;
    /* Slightly more padding for pill shape */
    border-radius: 999px;
    /* Full pill shape */
    font-size: 0.7rem;
    /* Smaller font */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background-color: hsl(var(--tag-hue), var(--tag-sat), var(--tag-light));
    color: hsl(var(--tag-hue), 80%, var(--tag-text-light));
    border: 1px solid hsl(var(--tag-hue), var(--tag-sat), 80%);
    white-space: nowrap;
}

/* Meta info (Date & Location) */
.conference-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 4px;
}

.conference-date {
    display: inline-block;
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
}

.conference-location {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--muted-color);
}

.location-icon {
    opacity: 0.8;
}

.conference-actions {
    float: right;
    margin-left: 20px;
    margin-bottom: 10px;
}

.btn-visit {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.2s;
}

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

/* Info Section */
.conference-details {
    margin-top: 8px;
    /* border-top: 1px solid var(--sidebar-border); Removed border */
    /* padding-top: 15px; Reduced padding */
}

.info-toggle {
    background: none;
    border: none;
    color: var(--muted-color);
    cursor: pointer;
    font-size: 0.85rem;
    /* Slightly smaller */
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
    padding: 0;
}

.info-toggle:hover {
    color: var(--primary-color);
}

.chevron-icon {
    transition: transform 0.2s;
}

.info-toggle[aria-expanded="true"] .chevron-icon {
    transform: rotate(90deg);
}

.info-content {
    margin-top: 10px;
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.5;
}

.info-content[hidden] {
    display: none;
}

/* Dialog */
.settings-modal {
    margin: auto;
    padding: 0;
    border: none;
    border-radius: 16px;
    background: transparent;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.info-modal {
    width: 90%;
    max-width: 600px;
}

/* Markdown Content Styles */
.markdown-body {
    line-height: 1.6;
}

.markdown-body h1 {
    font-size: 1.5em;
    margin-bottom: 0.5em;
    border-bottom: 1px solid var(--sidebar-border);
    padding-bottom: 0.3em;
}

.markdown-body h2 {
    font-size: 1.3em;
    margin-top: 1em;
    margin-bottom: 0.5em;
}

.markdown-body p {
    margin-bottom: 1em;
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 20px;
    margin-bottom: 1em;
}

.settings-modal::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-header {
    background-color: var(--dialog-bg);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--sidebar-border);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    color: var(--text-color);
}

.modal-body {
    background-color: var(--dialog-bg);
    padding: 24px;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
    color: var(--text-color);
    min-width: 300px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.7;
}

.close-btn:hover {
    opacity: 1;
}

.theme-options {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.theme-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--sidebar-border);
    border-radius: 8px;
    background-color: transparent;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
}

.theme-btn:hover {
    background-color: rgba(128, 128, 128, 0.1);
    border-color: var(--primary-color);
}

/* Mini Calendar */
.calendar-widget {
    padding: 20px;
    margin-top: auto;
    /* Push to bottom */
    width: 100%;
    border-top: 1px solid var(--sidebar-border);
    position: relative;
    /* Context for tooltip */
}

/* Info Panel Styles */
.calendar-info-panel {
    min-height: 120px;
    padding: 15px;
    border-bottom: 1px solid var(--sidebar-border);
    background: var(--bg-color);
    /* Match sidebar bg */
    overflow-y: auto;
    max-height: 200px;
}

.info-event {
    margin-bottom: 12px;
    border-bottom: 1px solid var(--sidebar-border);
    padding-bottom: 8px;
}

.info-event:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.info-title {
    margin: 0 0 4px 0;
    font-size: 0.95em;
    line-height: 1.3;
}

.info-title a {
    color: var(--primary-color);
    text-decoration: none;
}

.info-title a:hover {
    text-decoration: underline;
}

.info-meta {
    font-size: 0.8em;
    color: var(--muted-color);
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 6px;
}

.info-desc {
    font-size: 0.8em;
    margin: 0 0 8px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.info-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.info-tag {
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 10px;
    color: #fff;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.tooltip-tag {
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 10px;
    color: #fff;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.theme-modern .calendar-tooltip {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.theme-dark .calendar-tooltip {
    background: #2d2d2d;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.9em;
    font-weight: 600;
}

.cal-nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.6;
    padding: 4px 8px;
    border-radius: 4px;
}

.cal-nav-btn:hover {
    background-color: rgba(128, 128, 128, 0.1);
    opacity: 1;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.7em;
    color: var(--muted-color);
    margin-bottom: 5px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    border-radius: 4px;
    position: relative;
    cursor: default;
}

.calendar-day.empty {
    background: none;
}

.calendar-day.today {
    background-color: var(--sidebar-border);
    font-weight: bold;
}

.calendar-dots {
    display: flex;
    gap: 2px;
    margin-top: 2px;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: center;
}

.event-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
}

/* Submission Form Styles */
.submit-modal {
    width: 90%;
    max-width: 500px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="date"],
.form-group textarea {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--sidebar-border);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: 0.95em;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 8px 0;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    font-size: 0.85em;
    cursor: pointer;
    background-color: var(--sidebar-border);
    padding: 4px 10px;
    border-radius: 20px;
    transition: background-color 0.2s;
}

.checkbox-group label:hover {
    background-color: rgba(128, 128, 128, 0.2);
}

.checkbox-group input {
    margin: 0;
}

/* Form Filter Buttons (Reusing profession-tag styles) */
.profession-tag.form-btn {
    cursor: pointer;
    opacity: 0.5;
    filter: grayscale(0.8);
    transition: all 0.2s ease;
    border: 2px solid transparent;
    /* Prevent layout shift */
}

.profession-tag.form-btn:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

.profession-tag.form-btn.selected {
    opacity: 1;
    filter: none;
    border-color: var(--text-color);
    /* Highlight selected */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.profession-filters.form-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
}

.btn-submit {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.form-actions-row {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-secondary {
    width: 100%;
    padding: 12px;
    background-color: var(--sidebar-border);
    color: var(--text-color);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: rgba(128, 128, 128, 0.4);
}