* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --light: #f8fafc;
    --dark: #1e293b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.login-box h1 {
    text-align: center;
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.login-box h2 {
    text-align: center;
    color: var(--secondary);
    font-size: 1.2rem;
    margin-bottom: 30px;
    font-weight: normal;
}

.login-info {
    text-align: center;
    margin-top: 20px;
    color: var(--secondary);
}

/* Navbar */
.navbar {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    border-bottom: 2px solid rgba(37, 99, 235, 0.1);
}

.nav-brand {
    display: flex;
    align-items: center;
}

.brand-link {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.brand-logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary);
    line-height: 1.2;
    letter-spacing: 1px;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--secondary);
    font-weight: 500;
    margin-top: 2px;
    letter-spacing: 0.5px;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 20px;
}

.nav-menu li a {
    color: var(--dark);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s;
}

.nav-menu li a:hover {
    background: var(--light);
    color: var(--primary);
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 120px);
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Dashboard Header */
.dashboard-header {
    margin-bottom: 30px;
}

.dashboard-title {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    color: white;
}

.dashboard-title h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: white;
    letter-spacing: 0.5px;
}

.dashboard-subtitle {
    font-size: 1rem;
    opacity: 0.95;
    font-weight: 400;
    margin: 0;
}

/* Stats Header */
.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.stats-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--dark);
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.card h2 {
    margin-bottom: 24px;
    color: var(--dark);
    font-size: 1.5rem;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    padding-bottom: 12px;
}

.welcome-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.welcome-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.welcome-card h2 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
    color: white;
}

.welcome-subtitle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    opacity: 0.95;
    margin: 0;
}

.welcome-label {
    font-weight: 500;
    opacity: 0.9;
}

.welcome-value {
    font-weight: 600;
    font-size: 1.05rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 28px 24px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    border-top: 4px solid var(--primary);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-top-color: var(--primary-dark);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 5px;
}

.stat-label {
    color: var(--secondary);
    font-size: 0.9rem;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--dark);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

table thead {
    background: var(--primary);
    color: white;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

table tbody tr:hover {
    background: var(--light);
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Quick Actions */
.quick-actions {
    margin-top: 30px;
    padding: 0;
}

.quick-actions h2 {
    margin-bottom: 24px;
    color: var(--dark);
    font-size: 1.5rem;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    padding-bottom: 12px;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
}

.action-card {
    background: white;
    border-radius: 12px;
    padding: 28px 24px;
    text-align: center;
    text-decoration: none;
    color: var(--dark);
    box-shadow: var(--shadow);
    transition: all 0.3s;
    border-top: 4px solid var(--primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    color: var(--primary);
    border-top-color: var(--primary-dark);
    background: linear-gradient(to bottom, white 0%, #f8fafc 100%);
}

.action-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.action-label {
    font-weight: 500;
}

/* Chart */
.chart-container {
    position: relative;
    height: 350px;
    margin-top: 24px;
    padding: 10px;
}

/* Footer */
.footer {
    background: white;
    text-align: center;
    padding: 20px;
    color: var(--secondary);
    border-top: 1px solid var(--border);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }
    
    .nav-menu {
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 20px;
        box-shadow: var(--shadow-md);
        display: none;
    }
    
    .brand-link {
        flex-direction: row;
        gap: 10px;
        align-items: center;
    }
    
    .brand-logo {
        font-size: 1.5rem;
    }
    
    .brand-subtitle {
        font-size: 0.7rem;
    }
    
    .dashboard-title h1 {
        font-size: 1.5rem;
    }
    
    .dashboard-subtitle {
        font-size: 0.9rem;
    }
    
    .welcome-card h2 {
        font-size: 1.4rem;
    }
    
    .stats-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 14px 16px;
    }
    
    .stats-header form {
        width: 100%;
    }
    
    .stats-header select {
        width: 100%;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .action-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .login-box {
        padding: 30px 20px;
    }
    
    .card {
        padding: 16px;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    table th,
    table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .action-grid {
        grid-template-columns: 1fr;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 2px solid var(--border);
    background: linear-gradient(135deg, #f8fafc 0%, white 100%);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark);
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
}

.modal-close-btn:hover {
    background: var(--light);
    color: var(--danger);
}

.modal-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
}

/* Edit Form Styles */
.edit-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.edit-section {
    background: #f8fafc;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border);
}

.section-header {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0 0 8px 0;
}

.section-description {
    font-size: 0.9rem;
    color: var(--secondary);
    margin: 0;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.member-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 350px;
    overflow-y: auto;
    padding: 4px;
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: white;
    border-radius: 8px;
    border: 2px solid var(--border);
    transition: all 0.2s;
}

.member-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.member-item.marked-for-delete {
    background: #fef2f2;
    border-color: var(--danger);
    opacity: 0.8;
}

.member-item.marked-for-delete .member-name,
.member-item.marked-for-delete .member-position {
    text-decoration: line-through;
    color: var(--secondary);
}

.member-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--primary);
}

.member-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.member-label {
    flex: 1;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    min-width: 0;
}

.member-name {
    font-weight: 500;
    color: var(--dark);
    font-size: 0.95rem;
}

.member-position {
    font-size: 0.85rem;
    color: var(--secondary);
}

.member-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.amount-input {
    width: 180px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.amount-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.amount-input:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
    opacity: 0.6;
}

.delete-badge-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.delete-badge {
    padding: 6px 12px;
    background: #fee2e2;
    color: var(--danger);
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
    border: 1px solid #fecaca;
    display: inline-block;
}

.delete-badge-btn:hover .delete-badge {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.delete-label {
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 50px;
    text-align: right;
}

.add-anggota-controls {
    margin-bottom: 16px;
    padding: 16px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.default-amount-control {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.default-amount-label {
    display: block;
    font-size: 0.9rem;
    color: var(--secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.default-amount-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.default-amount-input {
    width: 180px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.default-amount-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.empty-state {
    padding: 30px;
    text-align: center;
    background: white;
    border-radius: 8px;
    border: 2px dashed var(--border);
}

.empty-state p {
    color: var(--secondary);
    margin: 0;
    font-size: 0.95rem;
}

.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 20px;
    border-top: 2px solid var(--border);
    justify-content: flex-end;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Mobile Responsive for Modal */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 10px;
    }
    
    .modal-container {
        max-height: 95vh;
        border-radius: 8px;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .modal-header h2 {
        font-size: 1.3rem;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .member-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 12px;
    }
    
    .member-info {
        width: 100%;
    }
    
    .member-actions {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .amount-input {
        width: 100%;
    }
    
    .delete-badge-btn {
        align-self: flex-start;
    }
    
    .default-amount-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .default-amount-label {
        width: 100%;
    }
    
    .default-amount-input {
        width: 100%;
    }
    
    .default-amount-input-group button {
        width: 100%;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
}

