/* Modern CSS with Tailwind-like utility classes */
/* Chinese Traditional support included */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --light: #f8fafc;
    --dark: #1e293b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--light);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navigation */
.navbar {
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    overflow: visible;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    text-decoration: underline;
    flex-shrink: 0;
    margin: 0;
    padding: 0.5rem 0;
}

.nav-brand a {
    color: var(--primary);
    text-decoration: underline;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    align-items: center;
}

.nav-menu > li {
    margin: 0;
    padding: 0;
    position: relative;
}

.nav-menu a,
.nav-menu .nav-dropdown-toggle {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 500;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    transition: all 0.3s;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    display: inline-block;
    white-space: nowrap;
    background: none;
    border: none;
    cursor: pointer;
}

.nav-menu a:hover,
.nav-menu a.active,
.nav-menu .nav-dropdown-toggle:hover,
.nav-menu .nav-dropdown-toggle.active,
.nav-dropdown.is-open > .nav-dropdown-toggle {
    color: var(--primary);
    background-color: var(--light);
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

/* Cards */
.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    transition: border-color 0.3s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    background-color: var(--light);
    color: var(--dark);
}

.table tbody tr:hover {
    background-color: var(--light);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Grid */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.ml-1 { margin-left: 0.5rem; }
.mr-1 { margin-right: 0.5rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-primary {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    border-radius: 0.5rem;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

/* Footer */
.footer {
    background-color: white;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--secondary);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 24px;
    background-color: var(--border);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    transition: width 0.3s;
}

/* Dashboard specific styles */
.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 2rem;
    font-weight: bold;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--secondary);
    margin-top: 0.5rem;
}

.stat-percentage {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--success);
    margin-top: 0.25rem;
}

.total-shares {
    text-align: center;
    padding: 2rem;
}

.total-percentage {
    font-size: 4rem;
    font-weight: bold;
    line-height: 1;
    margin-bottom: 1rem;
}

.total-percentage.valid {
    color: var(--success);
}

.total-percentage.invalid {
    color: var(--danger);
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.quick-actions .btn {
    flex: 1;
    min-width: 120px;
}

.meeting-list {
    list-style: none;
    padding: 0;
}

.meeting-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.meeting-item:last-child {
    border-bottom: none;
}

.meeting-title a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.meeting-title a:hover {
    text-decoration: underline;
}

.meeting-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--secondary);
}

/* Navigation dropdown — hover or click; sits above wrapped nav rows */
.nav-dropdown {
    position: relative;
    z-index: 1;
}

.nav-dropdown:hover,
.nav-dropdown.is-open {
    z-index: 50;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% - 4px);
    left: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    z-index: 50;
    margin: 0;
    padding: 0.35rem 0;
    list-style: none;
}

.dropdown-menu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -12px;
    height: 12px;
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown.is-open .dropdown-menu {
    display: block;
}

.dropdown-menu li {
    margin: 0;
    padding: 0;
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--secondary);
    text-decoration: none;
    transition: all 0.2s;
    border-radius: 0;
}

.dropdown-menu a:hover {
    background-color: var(--light);
    color: var(--primary);
}

/* Button variants */
.btn-info {
    background-color: var(--info);
    color: white;
}

.btn-info:hover {
    background-color: #0891b2;
}

.btn-warning {
    background-color: var(--warning);
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
}

/* Chinese font support */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

/* Enhanced card styles */
.card-body {
    padding: 1.5rem;
}

/* Form enhancements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    font-weight: 600;
    color: var(--dark);
}

/* Table enhancements */
.table th {
    background-color: var(--light);
    font-weight: 600;
    color: var(--dark);
    border-bottom: 2px solid var(--border);
}

.table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

/* Alert enhancements */
.alert {
    border-left: 4px solid;
    font-weight: 500;
}

.alert-success {
    border-left-color: var(--success);
}

.alert-danger {
    border-left-color: var(--danger);
}

.alert-warning {
    border-left-color: var(--warning);
}

.alert-info {
    border-left-color: var(--info);
}

/* Badge enhancements */
.badge {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Modal enhancements */
.modal-content {
    box-shadow: var(--shadow-lg);
    border: none;
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

/* Progress bar enhancements */
.progress-bar {
    background-color: var(--border);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    transition: width 0.5s ease;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .navbar .container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .nav-menu > li {
        width: 100%;
    }
    
    .nav-menu a,
    .nav-menu .nav-dropdown-toggle {
        width: 100%;
        display: block;
        text-align: left;
    }
    
    .dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        border: none;
        border-left: 2px solid var(--border);
        margin-left: 1rem;
        margin-top: 0.5rem;
    }
    
    .nav-brand {
        margin-bottom: 0;
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .quick-actions .btn {
        flex: none;
    }
    
    .total-percentage {
        font-size: 3rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .meeting-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}
