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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navbar */
.navbar {
    background: #1a1a2e;
    padding: 15px 0;
    color: white;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-email {
    color: #aaa;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    transition: opacity 0.2s;
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary {
    background: #4f46e5;
    color: white;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

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

.btn-sm {
    padding: 5px 10px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 15px 30px;
    font-size: 1.125rem;
}

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

/* Login Page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.login-container {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-container h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #1a1a2e;
}

.login-container .subtitle {
    color: #666;
    margin-bottom: 30px;
}

.btn-google {
    background: white;
    color: #333;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Dashboard */
.dashboard {
    padding: 30px 0;
}

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

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

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

.app-status {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.status-stopped { background: #9ca3af; }
.status-starting { background: #fbbf24; }
.status-running { background: #22c55e; }
.status-error { background: #dc2626; }

.app-card h3 {
    margin-bottom: 10px;
}

.app-meta {
    color: #666;
    font-size: 0.875rem;
    margin-bottom: 15px;
}

.app-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.empty-state {
    text-align: center;
    padding: 60px;
    color: #666;
}

/* App Edit */
.app-edit {
    padding: 30px 0;
}

.edit-header {
    margin-bottom: 30px;
}

.back-link {
    color: #4f46e5;
    text-decoration: none;
    display: block;
    margin-bottom: 10px;
}

.editable-title {
    font-size: 2rem;
    border: none;
    background: transparent;
    width: 100%;
    padding: 5px 0;
    border-bottom: 2px solid transparent;
}

.editable-title:focus {
    outline: none;
    border-bottom-color: #4f46e5;
}

.status-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: white;
}

.status-badge.status-stopped { background: #9ca3af; }
.status-badge.status-starting { background: #fbbf24; }
.status-badge.status-running { background: #22c55e; }
.status-badge.status-error { background: #dc2626; }

.edit-sections section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.edit-sections h2 {
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.agent-prompt {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 20px;
}

.agent-prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.agent-prompt h3 {
    color: #0369a1;
    margin: 0;
}

.agent-prompt ul {
    margin-left: 20px;
}

.agent-prompt code {
    background: #e0f2fe;
    padding: 2px 5px;
    border-radius: 3px;
}

.agent-prompt h4 {
    color: #0369a1;
    margin-top: 15px;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.agent-prompt pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 0.85rem;
    line-height: 1.4;
}

.agent-prompt .examples-section {
    margin-top: 12px;
    border: 1px solid #bae6fd;
    border-radius: 5px;
    background: #f8fafc;
}

.agent-prompt .examples-section summary {
    padding: 10px 12px;
    cursor: pointer;
    user-select: none;
}

.agent-prompt .examples-section summary:hover {
    background: #e0f2fe;
}

.agent-prompt .examples-section[open] summary {
    border-bottom: 1px solid #bae6fd;
}

.agent-prompt .example-code {
    padding: 12px;
}

.agent-prompt .example-code p {
    margin-top: 8px;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.agent-prompt .example-code p:first-child {
    margin-top: 0;
}

.upload-zone {
    border: 2px dashed #ccc;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: #4f46e5;
}

.upload-zone input {
    display: none;
}

.file-list {
    list-style: none;
}

.file-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.file-list li:last-child {
    border-bottom: none;
}

.file-list .empty {
    color: #999;
    text-align: center;
}

.deploy-section {
    text-align: center;
}

.deploy-hint {
    color: #666;
    margin-top: 10px;
}

/* Logs section */
.logs-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.logs-header h2 {
    margin: 0;
    border: none;
    padding: 0;
}

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

.install-status {
    margin-bottom: 10px;
}

.install-status .status-success {
    color: #22c55e;
    font-weight: bold;
}

.install-status .status-failed {
    color: #dc2626;
    font-weight: bold;
}

.install-status .status-running {
    color: #f59e0b;
    font-weight: bold;
}

.logs-output {
    background: #1e293b;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* App Share */
.app-share {
    padding: 30px 0;
    max-width: 600px;
    margin: 0 auto;
}

.share-header {
    margin-bottom: 30px;
}

.share-section, .shared-list-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.share-form {
    display: flex;
    gap: 10px;
}

.share-form input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.shared-list {
    list-style: none;
}

.shared-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.shared-list li:last-child {
    border-bottom: none;
}

.shared-list .empty {
    color: #999;
    text-align: center;
}

/* Error Page */
.error-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
    padding: 20px;
}

.error-page h1 {
    color: #dc2626;
    margin-bottom: 15px;
}

.error-message {
    color: #666;
    margin-bottom: 30px;
    max-width: 400px;
}

/* Starting Page */
.starting-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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