@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Color Palette */
    --primary: #4F46E5;
    --primary-hover: #4338ca;
    --primary-light: #EEF2FF;

    --bg-body: #F3F4F6;
    --bg-card: #FFFFFF;
    --bg-sidebar: #FFFFFF;

    --text-main: #111827;
    --text-sub: #6B7280;
    --text-light: #9CA3AF;

    --border: #E5E7EB;
    --divider: #F3F4F6;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --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);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;

    --header-height: 64px;
    --sidebar-width: 260px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Pretendard', 'Inter', sans-serif;
    background-color: --bg-body;
    color: var(--text-main);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
    /* App-like feel */
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 50;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding-left: 0.75rem;
    letter-spacing: 0.05em;
}

.nav-item {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-sub);
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-item:hover,
.nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-sub);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #F8FAFC;
    position: relative;
    width: 100%;
}

.top-header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 40;
}

.mobile-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-main);
}

.page-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background-color: white;
    border-color: var(--border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: var(--bg-body);
}

.btn-danger {
    background-color: #FEE2E2;
    color: #DC2626;
}

.btn-danger:hover {
    background-color: #FECACA;
}

/* Scrollable Content Area */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Auth Pages (Login/Signup center) */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #F3F4F6;
    padding: 1rem;
}

.auth-card {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.auth-title {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Components */
.card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-danger {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.alert-success {
    background: #ECFDF5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.alert-warning {
    background: #FFFBEB;
    color: #92400E;
    border: 1px solid #FDE68A;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Team Meeting 4-Split Grid */
.meeting-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.meeting-section {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.meeting-section-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meeting-editor {
    flex: 1;
    min-height: 200px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    font-family: inherit;
    resize: vertical;
}

.meeting-editor:focus {
    border-color: var(--primary);
    outline: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100%;
        width: 260px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        transition: left 0.3s ease;
        /* Animate 'left' property */
        transform: none;
        /* Reset transform */
    }

    .sidebar.show {
        left: 0;
    }

    .mobile-toggle {
        display: block;
    }

    .meeting-grid {
        grid-template-columns: 1fr;
    }

    .top-header {
        padding: 0 1rem;
    }

    .content-area {
        padding: 1rem;
    }

    /* Overlay for sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 40;
    }

    .sidebar-overlay.show {
        display: block;
    }

    /* --- Mobile UI Refinements --- */

    /* Typography */
    .page-title {
        font-size: 1.1rem;
    }

    h2 {
        font-size: 1.2rem !important;
    }

    /* Buttons */
    .btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }

    /* Header Actions (Write, List buttons) */
    .header-actions .btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }

    /* Search Form Stacking */
    /* Mobile Utility */
    .mobile-hidden {
        display: none !important;
    }

    /* Search Form Stacking - Optimized */
    .search-form {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .search-group {
        width: 100%;
        display: flex;
        flex-direction: row;
        /* Keep row for inline items */
        align-items: center;
        gap: 0.5rem;
    }

    .search-group label {
        display: none;
        /* Hide label 'Period' on mobile to save space */
    }

    /* Date Inputs: Inline */
    input[type="date"] {
        flex: 1;
        /* Share space equally */
        width: auto;
        font-size: 0.85rem;
        padding: 0.5rem;
    }

    /* Search Input + Button: Inline */
    input[name="keyword"] {
        flex: 1;
    }

    .search-group button {
        width: auto;
        white-space: nowrap;
    }

    .form-control {
        font-size: 16px;
        /* Avoid iOS zoom */
        width: 100%;
    }

    /* Table Styles */
    .card {
        padding: 0.5rem;
        /* Tighter padding */
        overflow-x: hidden;
        /* No scroll needed if we hide columns */
    }

    .data-table {
        min-width: 100%;
        /* Fit screen */
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.25rem;
        font-size: 0.9rem;
    }

    /* Dashboard Mobile Fixes */
    .dashboard-stats {
        grid-template-columns: 1fr;
        /* Stack cards vertically */
        gap: 1rem;
    }

    .quick-actions {
        flex-direction: column;
        /* Stack buttons vertically */
    }

    .quick-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Ensure content isn't hidden behind bottom bars if any */
    .content-area {
        padding-bottom: 80px;
    }
}

/* File Attachment Item (Thin Style) */
.file-attachment-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0 0.6rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-sub);
    font-size: 0.85rem;
    height: 30px;
    /* Constant Thin Height */
    white-space: nowrap;
    transition: background-color 0.2s;
}

.file-attachment-item:hover {
    background-color: #f3f4f6;
    color: var(--text-main);
}

/* Consolidated Meeting View Styles */
.consolidated-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.team-label {
    min-width: 100px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
    padding-top: 0.2rem;
}

.content-box {
    flex: 1;
    white-space: pre-wrap;
    color: var(--text-sub);
    line-height: 1.6;
    background: #F9FAFB;
    padding: 0.75rem;
    border-radius: 6px;
}

/* Mobile Overrides for Consolidated View */
@media (max-width: 768px) {
    .consolidated-item {
        flex-direction: column;
        gap: 0.5rem;
        padding-bottom: 1rem;
        border-bottom: 1px dashed #eee;
        margin-bottom: 1rem;
    }

    .consolidated-item:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }

    .team-label {
        min-width: unset;
        width: 100%;
        color: var(--primary);
        font-size: 1rem;
        padding-top: 0;
    }

    .content-box {
        width: 100%;
        background: #f8fafc;
        border: 1px solid #f1f5f9;
    }
}