/* Parent Portal Styles */

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

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

/* Screens */
.screen {
    display: none !important;
}

.screen.active {
    display: block !important;
}

/* Login/Register Screen */
#login-screen, #register-screen {
    min-height: 100vh;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#login-screen.active, #register-screen.active {
    display: flex !important;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    margin-bottom: 10px;
    color: #333;
}

.login-container p {
    margin-bottom: 25px;
    color: #666;
}

.login-container input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.login-container button {
    width: 100%;
    padding: 12px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.login-container button:hover {
    background-color: #5568d3;
}

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

.register-link a {
    color: #667eea;
    text-decoration: none;
    font-weight: bold;
}

.register-link a:hover {
    text-decoration: underline;
}

.admin-login-link {
    margin-top: 15px;
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.admin-login-link a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: #999;
    text-decoration: none;
    border-radius: 50%;
    transition: all 0.3s;
}

.admin-login-link a:hover {
    color: #667eea;
    background-color: #f0f0f0;
}

/* Portal Screen */
.portal-header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.portal-header h1 {
    font-size: 24px;
    color: #333;
}

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

.portal-container {
    display: flex;
    height: calc(100vh - 80px);
}

/* Landing Page */
.landing-container {
    padding: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.landing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.landing-header h2 {
    font-size: 28px;
    color: #333;
}

.landing-actions {
    display: flex;
    gap: 15px;
}

.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.user-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
}

.user-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.user-card h3 {
    font-size: 22px;
    margin-bottom: 10px;
    color: #333;
}


.user-card .user-stats {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #888;
}

.user-card .user-url {
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.user-card .user-url label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    font-weight: bold;
}

.user-card .url-display {
    display: flex;
    gap: 5px;
    align-items: center;
}

.user-card .url-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
    background: white;
    cursor: text;
}

.user-card .btn-copy-url {
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.user-card .btn-copy-url:hover {
    background: #5568d3;
}

/* Layout Editor Screen */
.layout-editor-container {
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

.layout-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.layout-editor-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
}

/* Tile Editor Screen */
.tile-editor-container {
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

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

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

.editor-tab-btn:hover {
    color: #667eea;
}

.editor-tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: bold;
}

.editor-tab-content {
    display: none;
}

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

/* This Is Me Styles */
.thisisme-step {
    padding: 20px;
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
}

.thisisme-step h3 {
    margin-bottom: 15px;
    color: #333;
}

.thisisme-step p {
    color: #666;
    margin-bottom: 15px;
}

#hero-image-upload {
    cursor: pointer;
    transition: all 0.3s;
}

#hero-image-upload:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.tile-button-card {
    transition: all 0.3s;
}

.tile-button-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #667eea !important;
}

.tile-button-card:active {
    transform: translateY(0);
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: #fff;
    border-right: 1px solid #e0e0e0;
    padding: 20px 0;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
}

.nav-btn {
    padding: 15px 25px;
    border: none;
    background: none;
    text-align: left;
    font-size: 16px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.nav-btn:hover {
    background-color: #f5f5f5;
    color: #333;
}

.nav-btn.active {
    background-color: #f0f4ff;
    color: #667eea;
    border-left-color: #667eea;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.tab-content {
    display: none;
}

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

.tab-content h2 {
    margin-bottom: 20px;
    color: #333;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-success, .btn-danger {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5568d3;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-success {
    background-color: #27ae60;
    color: white;
}

.btn-success:hover {
    background-color: #229954;
}

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

.btn-danger:hover {
    background-color: #c0392b;
}

/* Children List */
.children-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.child-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.child-card h3 {
    margin-bottom: 10px;
    color: #333;
}

.child-card p {
    color: #666;
    margin-bottom: 5px;
    font-size: 14px;
}

.child-card-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.child-card-actions button {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

/* Layout Editor */
.layout-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.layout-controls label {
    font-weight: 600;
}

.layout-controls select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.color-picker {
    margin-bottom: 20px;
}

#color-swatches {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.color-swatch {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #667eea;
}

.layout-editor {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.layout-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 10px;
    background: white;
    padding: 15px;
    border-radius: 10px;
    min-height: 500px;
}

.grid-slot {
    background: #f8f8f8;
    border: 2px dashed #ddd;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.grid-slot.empty {
    background: #fafafa;
}

.grid-slot.filled {
    background: white;
    border-style: solid;
    border-color: #667eea;
}

.grid-slot.drop-target {
    background-color: #e8f4f8;
    border-color: #667eea;
}

.grid-slot img {
    width: 70%;
    height: 70%;
    object-fit: contain;
}

.grid-slot .tile-name {
    font-size: 10px;
    color: #666;
    text-align: center;
    margin-top: 5px;
}

.grid-slot .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    cursor: pointer;
    display: none;
}

.grid-slot.filled:hover .remove-btn {
    display: block;
}

.available-tiles {
    background: white;
    padding: 15px;
    border-radius: 10px;
    max-height: 600px;
    overflow-y: auto;
}

.available-tiles h3 {
    font-size: 16px;
    margin-bottom: 15px;
}

.tile-search {
    margin-bottom: 15px;
}

.tile-search input, .tile-search select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

#available-tiles-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.available-tile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8f8f8;
    border-radius: 8px;
    cursor: grab;
    transition: all 0.3s;
}

.available-tile:hover {
    background: #e8f4f8;
}

.available-tile.selected {
    background: #d0e7f5;
    border: 2px solid #667eea;
}

.available-tile img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.available-tile .tile-info {
    flex: 1;
}

.available-tile .tile-info p {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.available-tile .tile-info span {
    font-size: 11px;
    color: #999;
}

/* Tiles Grid */
.tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.tile-card {
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.tile-card img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    margin-bottom: 10px;
}

.tile-card h4 {
    margin-bottom: 10px;
    color: #333;
}

.tile-card .tile-meta {
    font-size: 12px;
    color: #999;
    margin-bottom: 10px;
}

.tile-card-actions {
    display: flex;
    gap: 10px;
}

.tile-card-actions button {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

/* Repository */
.repository-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.repository-controls input, .repository-controls select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.repository-controls input {
    flex: 1;
    min-width: 200px;
}

/* AI Maker */
.ai-maker-container {
    background: white;
    border-radius: 10px;
    height: 80vh;
    overflow: hidden;
}

#ai-maker-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-content .close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 30px;
    cursor: pointer;
    color: #999;
}

.modal-content .close:hover {
    color: #333;
}

.modal-content h2 {
    margin-bottom: 20px;
}

.modal-content label {
    display: block;
    margin-bottom: 5px;
    margin-top: 15px;
    font-weight: 600;
}

.modal-content input, .modal-content select, .modal-content textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.modal-content input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.modal-content input[type="range"] {
    width: calc(100% - 50px);
    display: inline-block;
}

#image-preview, #audio-preview {
    margin-top: 10px;
}

#image-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-buttons button {
    flex: 1;
}

/* Error Messages */
.error-message {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 10px;
    min-height: 20px;
}

/* Warning Messages */
.warning-message {
    color: #f39c12;
    font-size: 14px;
    margin-top: 10px;
    padding: 10px;
    background-color: #fff3cd;
    border-left: 4px solid #f39c12;
    border-radius: 4px;
    min-height: 20px;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: #667eea;
}

/* Responsive */
@media (max-width: 768px) {
    .portal-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .sidebar nav {
        flex-direction: row;
        overflow-x: auto;
    }
    
    .layout-editor {
        grid-template-columns: 1fr;
    }
    
    .layout-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(8, 1fr);
    }
}

