/* --- Base Body Styles --- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f7f6;
    color: #333;
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
}

/* Override for Login Page */
body.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    max-width: 100%;
    padding: 0;
}

/* --- Header Styles --- */
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; background: #fff; padding: 15px 25px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.header h1 { margin: 0; font-size: 24px; text-align: left; }
.user-info { display: flex; align-items: center; gap: 15px; font-size: 14px; color: #555; }
.logout-btn { background: #95a5a6; color: white; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-size: 14px; width: auto; transition: background 0.3s; }
.logout-btn:hover { background: #7f8c8d; }
.logout-form { margin: 0; padding: 0; width: auto; display: inline-block; }

/* --- Card Styles --- */
.card { background: #fff; padding: 25px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); margin-bottom: 30px; }
.login-card { background: #fff; padding: 40px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); width: 100%; max-width: 400px; }

/* --- Form Elements --- */
input[type="text"], input[type="password"], input[type="file"] { width: 100%; padding: 12px; margin: 10px 0; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; font-size: 16px; }

/* --- Base Buttons --- */
button { background: #3498db; color: white; border: none; padding: 12px 20px; border-radius: 4px; cursor: pointer; font-size: 16px; width: 100%; transition: background 0.3s; }
button:hover { background: #2980b9; }
#error-msg { color: #e74c3c; text-align: center; margin-top: 15px; font-weight: bold; display: none; }

/* --- Project List --- */
.project-list { list-style: none; padding: 0; }
.project-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; border-bottom: 1px solid #eee; gap: 15px; }
.project-item:last-child { border-bottom: none; }
.project-item-empty { text-align: center; color: #7f8c8d; padding: 20px; }

.project-favicon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f4f7f6;
}

.project-main-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.project-name-link {
    font-weight: 600;
    color: #2c3e50;
    cursor: pointer;
    transition: color 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.project-name-link:hover { color: #3498db; text-decoration: underline; }

.project-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.project-quick-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Badges */
.badge-hidden { font-size: 11px; background: #e74c3c; color: white; padding: 2px 6px; border-radius: 12px; font-weight: normal; }
.badge-form { font-size: 11px; background: #27ae60; color: white; padding: 2px 6px; border-radius: 12px; font-weight: normal; }
.badge-stack { font-size: 14px; color: #7f8c8d; display: flex; align-items: center; }

.project-name.hidden-project { color: #95a5a6; } 

#status { margin-top: 15px; font-weight: bold; text-align: center; }
.success { color: #27ae60; }
.error { color: #e74c3c; }

/* --- Action Buttons --- */
.actions { display: flex; gap: 8px; align-items: center; }

.icon-btn {
    background: none; 
    border: 1px solid transparent; 
    color: #7f8c8d; 
    cursor: pointer; 
    padding: 8px 10px; 
    border-radius: 6px; 
    font-size: 16px; 
    width: auto; 
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover { background: #ecf0f1; color: #2c3e50; }

.icon-btn.danger:hover { background: #fdedec; color: #e74c3c; }
.icon-btn.success:hover { background: #eafaf1; color: #27ae60; }
.icon-btn.warning:hover { background: #fef9e7; color: #f39c12; }
.icon-btn.primary:hover { background: #ebf5fb; color: #3498db; }
.icon-btn.form-btn:hover { background: #e8f8f5; color: #1abc9c; }

.icon-btn.muted { color: #bdc3c7; cursor: not-allowed; }
.icon-btn.muted:hover { background: none; color: #bdc3c7; }

/* --- Base Modal Styles (Shared) --- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15, 20, 25, 0.6);
    backdrop-filter: blur(4px); display: none; align-items: center;
    justify-content: center; padding: 20px;
}
.modal-overlay.active { display: flex; }

/* Individual z-index for stacking order */
#modal-overlay { z-index: 1010; }
#paas-modal-overlay { z-index: 1005; }
#project-modal-overlay { z-index: 1000; }

.modal-box {
    background: #fff; padding: 32px; border-radius: 10px; width: 100%;
    max-width: 640px; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    position: relative; animation: modalFadeIn 0.3s ease-out;
    max-height: 90vh; overflow-y: auto;
}
@keyframes modalFadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

.modal-box h2, .paas-modal-box h2 { margin: 0 0 8px; font-size: 22px; color: #2c3e50; }
.modal-box p, .paas-modal-box p { margin: 0 0 16px; font-size: 14px; color: #6B7280; line-height: 1.5; }

.modal-textarea {
    width: 100%; height: 220px; padding: 16px; border: 1px solid #E5E2DA;
    border-radius: 6px; font-family: 'Consolas', 'Monaco', monospace; font-size: 13px;
    line-height: 1.6; color: #333; resize: none; box-sizing: border-box;
    outline: none; transition: border-color 0.2s;
}
.modal-textarea:focus { border-color: #C9A461; }

.modal-actions, .paas-modal-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 10px; }
.btn-modal, .btn-paas-modal { padding: 10px 20px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all 0.2s; width: auto; }
.btn-modal-close, .btn-paas-modal-close { background: #f4f7f6; color: #555; border-color: #ccc; }
.btn-modal-close:hover, .btn-paas-modal-close:hover { background: #e8e8e8; }
.btn-modal-copy, .btn-paas-modal-copy { background: #C9A461; color: #fff; border-color: #C9A461; }
.btn-modal-copy:hover, .btn-paas-modal-copy:hover { background: #b8923e; }

/* Modal Project Specific Styles */
.project-modal-box {
    max-width: 540px;
}

.project-modal-close {
    position: absolute; top: 15px; right: 20px; background: none; border: none;
    font-size: 28px; color: #95a5a6; cursor: pointer; padding: 0; width: auto;
}
.project-modal-close:hover { color: #e74c3c; }

.project-modal-header {
    display: flex; align-items: center; gap: 16px; margin-bottom: 24px;
}
.project-modal-favicon {
    width: 48px; height: 48px; border-radius: 8px; object-fit: cover;
    background: #f4f7f6; border: 1px solid #eee; flex-shrink: 0;
}
.project-modal-title h2 { margin: 0; font-size: 22px; }
.project-modal-badges { display: flex; gap: 8px; margin-top: 6px; }

.badge-modal {
    font-size: 12px; padding: 3px 8px; border-radius: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px;
}
.badge-success { background: #eafaf1; color: #27ae60; }
.badge-danger { background: #fdedec; color: #e74c3c; }
.badge-primary { background: #ebf5fb; color: #3498db; }
.badge-form { background: #e8f8f5; color: #1abc9c; }

.project-modal-section {
    margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid #eee;
}
.project-modal-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.project-modal-section label { display: block; font-size: 14px; font-weight: 600; color: #2c3e50; margin-bottom: 10px; }
.project-modal-section p { margin: 0 0 12px; font-size: 14px; color: #6B7280; }

.url-copy-group {
    display: flex; gap: 10px;
}
.url-copy-group input[type="text"] {
    margin: 0; background: #f8f9fa; font-size: 14px; padding: 10px;
}
.url-copy-group button { width: auto; padding: 10px 15px; white-space: nowrap; }

.project-modal-form-actions {
    display: flex; gap: 10px; flex-wrap: wrap;
}

.project-modal-actions {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}

.btn-modal-primary { background: #3498db; color: #fff; }
.btn-modal-primary:hover { background: #2980b9; }
.btn-modal-default { background: #f4f7f6; color: #555; border-color: #ccc; }
.btn-modal-default:hover { background: #e8e8e8; }
.btn-modal-warning { background: #f39c12; color: #fff; }
.btn-modal-warning:hover { background: #e67e22; }
.btn-modal-success { background: #27ae60; color: #fff; }
.btn-modal-success:hover { background: #219150; }
.btn-modal-danger { background: #e74c3c; color: #fff; grid-column: 1 / -1; }
.btn-modal-danger:hover { background: #c0392b; }

/* --- PaaS Info Button --- */
.paas-info-btn {
    display: inline-block; margin-top: 10px; margin-bottom: 5px; font-size: 14px; color: #3498db; 
    text-decoration: none; font-weight: 500; transition: color 0.2s;
}
.paas-info-btn:hover { color: #2980b9; text-decoration: underline; }

/* --- PaaS Instruction Content Styles --- */
.paas-instructions { font-size: 14px; color: #4B5563; line-height: 1.6; }
.paas-instructions h3 { font-size: 16px; color: #2c3e50; margin-top: 16px; margin-bottom: 8px; border-bottom: 1px solid #eee; padding-bottom: 4px; }
.paas-instructions h3:first-child { margin-top: 0; }
.paas-instructions ul { padding-left: 20px; margin-bottom: 10px; }
.paas-instructions li { margin-bottom: 6px; }
.paas-instructions strong { color: #1F2937; }
.paas-instructions pre { 
    background: #F8F9FA; border: 1px solid #E5E7EB; border-radius: 6px; 
    padding: 12px; margin: 10px 0; overflow-x: auto; font-size: 13px; line-height: 1.5;
}
.paas-instructions code { font-family: 'Consolas', 'Monaco', monospace; color: #D63384; }
.paas-instructions pre code { color: #333; }