:root {
    --primary: #FF6B35;
    --primary-dark: #E85A2A;
    --secondary: #4ECDC4;
    --accent: #FFD23F;
    --bg-main: #FFF8F0;
    --bg-card: #FFFFFF;
    --text-dark: #2D3142;
    --text-light: #6C757D;
    --success: #52B788;
    --warning: #F4A261;
    --danger: #E63946;
    --border: #E8E8E8;
    --shadow: rgba(0, 0, 0, 0.08);
    --shadow-hover: rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] {
    --primary: #FF8A5B;
    --primary-dark: #FF6B35;
    --secondary: #5EDDD4;
    --accent: #FFE066;
    --bg-main: #2D1B0E;
    --bg-card: #3D3D3D;
    --text-dark: #E8E8E8;
    --text-light: #B8B8B8;
    --success: #6FD89D;
    --warning: #F4A261;
    --danger: #FF6B6B;
    --border: #555555;
    --shadow: rgba(0, 0, 0, 0.4);
    --shadow-hover: rgba(0, 0, 0, 0.6);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.6;
}

#root { min-height: 100vh; }

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #FF6B35 0%, #F4A261 100%);
}

.login-box {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 2rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary);
}

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

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
    background: var(--bg-main);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

textarea.form-input { resize: vertical; }
select.form-input { cursor: pointer; }

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 53, 0.3);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover { background: #3DB9AF; transform: translateY(-2px); }

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) { background: #D62839; }

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.app-header {
    background: white;
    padding: 16px 24px;
    box-shadow: 0 2px 8px var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

[data-theme="dark"] .app-header {
    background: #3D3D3D;
}

[data-theme="dark"] .birthday-notification {
    background: #3D3D3D !important;
    color: #E8E8E8 !important;
}

[data-theme="dark"] .modal {
    color: #E8E8E8;
}

[data-theme="dark"] .form-label {
    color: #E8E8E8;
}

[data-theme="dark"] .checkbox-container label {
    color: #E8E8E8;
}

[data-theme="dark"] .form-input,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    color: #E8E8E8 !important;
    background: var(--bg-card) !important;
}

[data-theme="dark"] .form-input::placeholder,
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #888888;
}

[data-theme="dark"] .random-prayer-text {
    color: #2D2D2D !important;
}

[data-theme="dark"] .knowledge-box {
    color: #2D2D2D !important;
}

[data-theme="dark"] .knowledge-box * {
    color: #2D2D2D !important;
}

.app-logo {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    font-size: 0.9rem;
    color: var(--text-light);
}

.icon-btn {
    background: var(--bg-main);
    border: none;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.main-content {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.tile {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 4px 12px var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px var(--shadow-hover);
}

.tile-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.tile-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    white-space: pre-line;
}

.card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
    gap: 12px;
}

.card-header .card-title {
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-header .btn {
    flex-shrink: 1;
    white-space: normal;
    min-width: fit-content;
    max-width: 180px;
    padding: 8px 16px;
}

.card-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

h1, h2, h3 {
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.2rem; }

.item-name {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
}

.child-name {
    font-family: 'Fredoka', sans-serif;
}

.children-grid {
    display: grid;
    gap: 20px;
}

.child-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.3s ease;
}

.child-card.inactive {
    opacity: 0.5;
    background: #F5F5F5;
}

.child-card.birthday {
    border: 3px solid var(--accent);
    box-shadow: 0 0 20px rgba(255, 210, 63, 0.5);
    animation: birthday-glow 2s ease-in-out infinite;
}

@keyframes birthday-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 210, 63, 0.5); }
    50% { box-shadow: 0 0 30px rgba(255, 210, 63, 0.8); }
}

.child-name {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
}

.child-info {
    margin-bottom: 12px;
    color: var(--text-light);
    font-size: 0.9rem;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.status-registered {
    background: #D1F2EB;
    color: #0F5132;
}

.status-trial {
    background: #FFF3CD;
    color: #856404;
}

.status-nami {
    background: #F8D7DA;
    color: #721C24;
}

.child-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.child-actions .btn {
    flex: 1;
    min-width: 120px;
    white-space: nowrap;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal {
    background: var(--bg-card);
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 1;
}

.modal > form,
.modal > div:not(.modal-header) {
    overflow-y: auto;
    padding: 20px 24px 24px 24px;
}

@media (max-width: 768px) {
    .modal-header {
        padding: 8px 12px;
    }

    .modal > form,
    .modal > div:not(.modal-header) {
        padding: 16px 20px 20px 20px;
    }
}

.modal-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    transition: color 0.3s ease;
}

.close-btn:hover { color: var(--danger); }

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}

.checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.alert-success { background: #D1F2EB; color: #0F5132; }
.alert-error { background: #F8D7DA; color: #721C24; }
.alert-warning { background: #FFF3CD; color: #856404; }
.alert-info { background: #D1ECF1; color: #0C5460; }

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .app-header { flex-direction: column; gap: 12px; }

    .modal-overlay {
        padding: 10px;
    }

    .modal {
        max-width: calc(100vw - 20px);
        margin: 0 10px;
    }
}

.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.w-100 { width: 100%; }
