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

:root {
    --primary: #667eea;
    --success: #48bb78;
    --danger: #f56565;
    --warning: #ed8936;
    --bg-light: #f7fafc;
    --bg-dark: #2d3748;
    --text-dark: #1a202c;
    --text-light: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-dark);
    padding-bottom: 2rem;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 700;
}

.settings-btn {
    background: var(--primary);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.settings-btn:active {
    transform: scale(0.95);
}

/* Kids Dashboard */
.kids-container {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.kid-card {
    flex: 1;
    min-width: 160px;
    background: white;
    border-radius: 16px;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.kid-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: var(--kid-color);
}

.kid-card.selected {
    transform: scale(1.05);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    border: 3px solid var(--kid-color);
    background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.95) 100%);
}

.kid-card:active {
    transform: scale(0.98);
}

.kid-initials {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--kid-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: bold;
    margin: 0 auto 0.5rem;
    box-shadow: var(--shadow);
}

.kid-name {
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.points-display {
    text-align: center;
    background: linear-gradient(135deg, var(--bg-light) 0%, #e6e9f0 100%);
    border-radius: 12px;
    padding: 0.75rem;
    margin-bottom: 0.25rem;
}

.points-number {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--kid-color);
    line-height: 1;
    margin-bottom: 0.15rem;
}

.points-label {
    font-size: 0.7rem;
    color: #718096;
    font-weight: 500;
}

.screen-time {
    text-align: center;
    font-size: 0.7rem;
    color: #4a5568;
    margin-top: 0.25rem;
}

/* Quick Actions Section */
.quick-actions {
    background: white;
    margin: 1rem;
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
}

.quick-actions h3 {
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-size: 1.3rem;
}

.selected-kid {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.points-input-section {
    margin-bottom: 1.5rem;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.number-input {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.number-input input {
    flex: 1;
    padding: 1rem;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-weight: 700;
    color: var(--primary);
}

.btn-number {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}

.btn-number:active {
    transform: scale(0.95);
}

.quick-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.quick-btn {
    padding: 0.75rem;
    background: #edf2f7;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-btn:active {
    background: var(--primary);
    color: white;
    transform: scale(0.95);
}

/* Tags Section */
.tags-section {
    margin-bottom: 1.5rem;
}

.tags-section label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-dark);
}

.tags-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag-btn {
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag-btn.selected {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: currentColor;
}

.tag-btn:active {
    transform: scale(0.95);
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.btn-add, .btn-remove {
    padding: 1.25rem;
    border: none;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

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

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

.btn-add:active, .btn-remove:active {
    transform: scale(0.95);
}

/* Activity Log */
.activity-log {
    background: white;
    margin: 1rem;
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
}

.activity-log h3 {
    margin-bottom: 1rem;
    color: var(--text-dark);
    font-size: 1.3rem;
}

.activity-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    padding: 1rem;
    background: var(--bg-light);
    border-left: 4px solid var(--kid-color);
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

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

.activity-kid {
    font-weight: 700;
    color: var(--kid-color);
}

.activity-points {
    font-weight: 700;
    font-size: 1.1rem;
}

.activity-points.positive {
    color: var(--success);
}

.activity-points.negative {
    color: var(--danger);
}

.activity-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.activity-time {
    font-size: 0.75rem;
    color: #718096;
    margin-top: 0.25rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    color: var(--text-dark);
    font-size: 1.5rem;
}

.close-btn {
    background: #e2e8f0;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-dark);
}

.close-btn:active {
    transform: scale(0.95);
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group input.error,
#passwordInput.error {
    border-color: var(--danger);
    background-color: #fff5f5;
}

#passwordInput {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

#passwordInput:focus {
    outline: none;
    border-color: var(--primary);
}

#passwordInput.error {
    border-color: var(--danger);
    background-color: #fff5f5;
}

.color-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.color-btn {
    width: 100%;
    aspect-ratio: 1;
    border: 3px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-btn.selected {
    border-color: var(--text-dark);
    transform: scale(1.1);
}

.color-btn:active {
    transform: scale(0.95);
}

/* Buttons */
.btn-primary, .btn-secondary {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.btn-secondary {
    background: #edf2f7;
    color: var(--text-dark);
    border: 2px solid #e2e8f0;
}

.btn-primary:active, .btn-secondary:active {
    transform: scale(0.95);
}

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

.error-message {
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    text-align: center;
}

/* Settings Content */
.kid-settings {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.kid-settings h4 {
    margin-bottom: 1rem;
    color: var(--text-dark);
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Responsive Design */
@media (min-width: 768px) {
    .kids-container {
        padding: 2rem;
        gap: 1.5rem;
    }
    
    .kid-card {
        min-width: 280px;
        padding: 1.5rem;
    }
    
    .kid-initials {
        width: 80px;
        height: 80px;
        font-size: 2rem;
        margin-bottom: 1rem;
    }
    
    .kid-name {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .points-display {
        padding: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .points-number {
        font-size: 3rem;
        margin-bottom: 0.25rem;
    }
    
    .points-label {
        font-size: 0.9rem;
    }
    
    .screen-time {
        font-size: 0.85rem;
        margin-top: 0.5rem;
    }
    
    .quick-actions,
    .activity-log {
        margin: 2rem;
        padding: 2rem;
    }
    
    .tags-container {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}
