/* CSS Variables for theming */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-sidebar: #1a1a1a;
    --bg-card: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --accent-primary: #f7941d;
    --accent-green: #4CAF50;
    --accent-red: #f44336;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Dark Mode Variables */
body.dark-mode {
    --bg-primary: #1a1a1a;
    --bg-secondary: #252525;
    --bg-sidebar: #141414;
    --bg-card: #252525;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #333333;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

/* Layout */
.app-layout {
    display: grid;
    grid-template-columns: 260px 1fr 320px;
    min-height: 100vh;
}

/* Left Sidebar */
.sidebar {
    background-color: var(--bg-sidebar);
    color: #ffffff;
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    z-index: 1000;
}

.sidebar-header {
    padding: 0 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
}

.logo-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.logo-subtitle {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
}

.sidebar-nav {
    flex: 1;
    padding: 0 1rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 0.25rem;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.nav-item.active {
    background-color: var(--accent-primary);
    color: #ffffff;
}

.nav-icon {
    font-size: 1.25rem;
}

.nav-label {
    font-size: 0.9375rem;
    font-weight: 500;
}

/* Main Content */
.main-content {
    margin-left: 260px;
    padding: 2rem;
    width: calc(100vw - 580px);
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.content-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #d67d14;
}

.announcements-section {
    margin-top: 2rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

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

/* Announcement Cards */
.announcement-card {
    background-color: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: grid;
    grid-template-columns: 200px 1fr auto;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.announcement-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card-image-section {
    position: relative;
}

.card-image-container {
    width: 100%;
    height: 150px;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.card-image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-image-placeholder {
    font-size: 3rem;
    color: var(--text-secondary);
}

.remove-image-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    z-index: 10;
}

.remove-image-btn:hover {
    background-color: rgba(244, 67, 54, 0.9);
}

.status-tag {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-tag.status-published {
    background-color: var(--accent-green);
    color: white;
}

.status-tag.status-draft {
    background-color: #9e9e9e;
    color: white;
}

.status-tag.status-scheduled {
    background-color: var(--accent-primary);
    color: white;
}

.card-content-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.card-text-preview {
    font-size: 0.9375rem;
    color: var(--text-primary);
    line-height: 1.5;
    padding: 0.5rem 0;
    min-height: 60px;
}

.card-text-input {
    width: 100%;
    min-height: 150px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 0.9375rem;
    font-family: inherit;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    resize: vertical;
}

.card-text-input-hidden {
    display: none;
}

.card-date-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.card-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}

.action-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
    color: var(--text-secondary);
}

.action-btn:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.card-hidden-controls {
    grid-column: 1 / -1;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    margin-top: 0.5rem;
    display: flex;
    gap: 1rem;
}

.image-position-select,
.status-select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.save-button {
    background-color: var(--accent-primary);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}

.status {
    font-weight: 500;
}

.status.success {
    color: var(--accent-green);
}

.status.error {
    color: var(--accent-red);
}

/* Right Sidebar */
.right-sidebar {
    background-color: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    padding: 2rem;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 320px;
    overflow-y: auto;
}

.widget {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

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

.widget-link {
    font-size: 0.875rem;
    color: var(--accent-primary);
    text-decoration: none;
}

.widget-link:hover {
    text-decoration: underline;
}

.widget-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Dark Mode Toggle */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toggle-icon {
    font-size: 1.25rem;
}

.toggle-input {
    display: none;
}

.toggle-label {
    position: relative;
    width: 48px;
    height: 24px;
    background-color: #ccc;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.toggle-label::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: white;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
}

.toggle-input:checked+.toggle-label {
    background-color: var(--accent-primary);
}

.toggle-input:checked+.toggle-label::before {
    transform: translateX(24px);
}

/* Theme Selector */
.theme-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.theme-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 80px;
}

.theme-btn:hover {
    border-color: var(--accent-primary);
}

.theme-btn.active {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.style-status {
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

/* Agenda Calendar Widget */
.agenda-calendar {
    margin-bottom: 1.5rem;
}

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

.calendar-day-header {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.5rem 0;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

.calendar-day.today {
    background-color: var(--accent-primary);
    color: white;
    font-weight: 600;
}

/* Agenda Widget List */
.agenda-widget-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.agenda-widget-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.agenda-time-indicator {
    width: 3px;
    border-radius: 2px;
    background-color: var(--accent-primary);
    flex-shrink: 0;
}

.agenda-time-indicator.all-day {
    background-color: #ff9800;
}

.agenda-widget-content {
    flex: 1;
    min-width: 0;
}

.agenda-widget-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.agenda-widget-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.no-events {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 1rem 0;
}

/* Login Form */
.login-container {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    text-align: center;
    margin-top: 50px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.login-container h1 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.login-container input {
    padding: 0.75rem;
    font-size: 1rem;
    width: 100%;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.login-container button {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
}

.error-message {
    color: var(--accent-red);
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .app-layout {
        grid-template-columns: 260px 1fr;
    }

    .right-sidebar {
        display: none;
    }

    .main-content {
        width: calc(100vw - 260px);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
        width: 100vw;
    }

    .announcement-card {
        grid-template-columns: 1fr;
    }
}

/* Agenda Section Layout */
.agenda-grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.agenda-column {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.list-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.list-card {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-primary);
    transition: transform 0.2s;
}

.list-card:hover {
    transform: translateX(4px);
    border-color: var(--accent-primary);
}

.list-left {
    min-width: 100px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.list-main {
    flex: 1;
}

.list-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.list-sub {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .agenda-grid-layout {
        grid-template-columns: 1fr;
    }
}