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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #66deea 0%, #a2854b 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
}

.header .user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header .role-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
}

.content {
    padding: 30px;
}

.nav-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.nav-tab {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #66deea;
    color: white;
}

.btn-primary:hover {
    background: #4fc3dc;
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
}

.btn-danger {
    background: #fc8181;
    color: white;
}

.btn-danger:hover {
    background: #f56565;
}

.btn-secondary {
    background: #b597cd;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 20px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    background: #f7fafc;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
}

table td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

table tr:hover {
    background: #f7fafc;
}

/* Cards */
.card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #2d3748;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: bold;
    margin: 10px 0;
}

.stat-card .stat-label {
    font-size: 14px;
    opacity: 0.9;
}

/* Category badges */
.category-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.category-school_and_learning {
    background: #bee3f8;
    color: #2c5282;
}

.category-no_screen_entertainments {
    background: #c6f6d5;
    color: #22543d;
}

.category-screen_entertainments {
    background: #fed7d7;
    color: #742a2a;
}

.category-non_school_learning {
    background: #fefcbf;
    color: #744210;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending {
    background: #fef5e7;
    color: #d68910;
}

.status-validated {
    background: #d5f4e6;
    color: #1e8449;
}

.status-rejected {
    background: #fadbd8;
    color: #943126;
}

/* Login/Register */
.auth-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
}

.auth-toggle {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

.auth-toggle a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.auth-toggle a:hover {
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

.alert {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d5f4e6;
    color: #1e8449;
    border: 1px solid #1e8449;
}

.alert-error {
    background: #fadbd8;
    color: #943126;
    border: 1px solid #943126;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.form-inline {
    display: flex;
    gap: 10px;
    align-items: end;
}

.form-inline .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Language Selector */
.language-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.language-selector select {
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: all 0.3s;
}

.language-selector select:hover {
    background: rgba(255, 255, 255, 0.3);
}

.language-selector select option {
    background: #667eea;
    color: white;
}

.lang-icon {
    font-size: 18px;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.modal-content form {
    padding: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover,
.close:focus {
    color: #000;
}

.btn-secondary {
    background: #b597cd;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Footer */
.footer {
    text-align: center;
    padding: 15px;
    color: #ffffff;
    font-size: 12px;
}

/* Small Button Styles */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Kid History Section */
.kid-history {
    border-top: 2px solid #e2e8f0;
    padding-top: 15px;
}

.kid-history h4 {
    margin-bottom: 15px;
    color: #2d3748;
}

/* Pagination Controls */
.pagination-controls {
    text-align: center;
}

.pagination-controls button {
    margin: 0 5px;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet and smaller (max-width: 768px) */
@media (max-width: 768px) {
    /* Body padding reduction */
    body {
        padding: 10px;
    }

    /* Header responsive */
    .header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .header h1 {
        font-size: 20px;
    }

    .header .user-info {
        width: 100%;
        justify-content: space-between;
    }

    /* Content padding reduction */
    .content {
        padding: 20px;
    }

    /* Navigation tabs - horizontal scroll */
    .nav-tabs {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        margin-bottom: 20px;
        padding-bottom: 5px;
    }

    .nav-tab {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 10px 16px;
        font-size: 14px;
    }

    /* Forms - stack vertically */
    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .form-inline .form-group {
        margin-bottom: 15px;
    }

    /* Tables transform to cards on mobile */
    .table-container {
        overflow-x: visible;
    }

    table, thead, tbody, th, td, tr {
        display: block;
    }

    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        background: white;
        border: 2px solid #66deea;
        border-radius: 12px;
        margin-bottom: 20px;
        padding: 15px;
        box-shadow: 0 4px 12px rgba(102, 222, 234, 0.2);
    }

    td {
        border: none;
        position: relative;
        padding-left: 50%;
        text-align: right;
        border-bottom: 1px solid #f0f0f0;
    }

    td:last-child {
        border-bottom: none;
    }

    td:before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
        color: #4a5568;
    }

    /* Action buttons in tables */
    td .action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 5px;
    }

    td .action-buttons .btn {
        flex: 0 0 auto;
        padding: 5px 10px;
        font-size: 11px;
        white-space: nowrap;
    }

    /* Card adjustments */
    .card {
        padding: 15px;
    }

    /* Modal adjustments */
    .modal-content {
        width: 95%;
        margin: 10px;
    }

    .modal-header,
    .modal-content form {
        padding: 15px;
    }

    /* Stats grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Mobile (max-width: 480px) */
@media (max-width: 480px) {
    /* Further reduce spacing */
    .content {
        padding: 15px;
    }

    .header {
        padding: 12px 15px;
    }

    .header h1 {
        font-size: 18px;
    }

    .header .role-badge {
        padding: 4px 10px;
        font-size: 12px;
    }

    /* Navigation tabs smaller */
    .nav-tab {
        padding: 8px 12px;
        font-size: 13px;
    }

    /* Form inputs */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Buttons smaller on very small screens */
    .btn:not(.btn-block) {
        padding: 6px 10px;
        font-size: 12px;
    }

    .action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 5px;
    }

    .action-buttons .btn {
        flex: 0 0 auto;
        padding: 5px 10px;
        font-size: 11px;
    }

    /* Card further reduced */
    .card {
        padding: 12px;
    }

    /* Stat cards */
    .stat-card .stat-value {
        font-size: 24px;
    }

    .stat-card .stat-label {
        font-size: 12px;
    }
}

/* ============= Avatar Upload Styles ============= */

.avatar-upload-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px;
}

.avatar-preview {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.avatar-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    border: 2px dashed var(--border-color);
}

.avatar-upload-controls {
    display: flex;
    gap: 5px;
}

/* Store item image styles */
.store-item-image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px;
}

.store-item-image-preview {
    max-width: 100px;
    max-height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--primary-color);
}

.store-item-image-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    background: var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    border: 2px dashed var(--border-color);
}

.store-item-image-controls {
    display: flex;
    gap: 5px;
}

/* Dashboard avatar display */
.kid-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    margin-bottom: 10px;
}

.kid-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
    margin-right: 10px;
}

/* Store item image in store view */
.store-item-image {
    width: 300px;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--primary-color);
}

/* Store items grid layout */
.store-items-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
}

@media (min-width: 768px) {
    .store-items-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .store-items-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.store-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease;
}

.store-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.store-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}
