:root {
    --primary: #4ECDC4;
    --primary-dark: #3DA9A1;
    --secondary: #FF6B6B;
    --dark: #1A1A2E;
    --light: #F0F4F8;
    --white: #FFFFFF;
    --text: #33475B;
    --border: #E2E8F0;
    --shadow: 0 10px 30px rgba(0,0,0,0.08);
    --admin-teal: #0d9488;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--light);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Essential for security: everything hidden by default */
#login-section, #dashboard-section, #create-ticket-section, #ticket-detail-section, #main-header {
    display: none;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: var(--white);
    padding: 15px 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
    text-decoration: none;
}

.logo span { color: var(--primary); }

#user-info-container {
    display: flex;
    align-items: center;
}

#user-email {
    margin-right: 15px;
    font-weight: 600;
    display: none;
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    font-family: inherit;
    font-size: 15px;
}

.btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--secondary); }
.btn-secondary:hover { background: #ff5252; }
.btn-admin { background: var(--admin-teal); }
.btn-admin:hover { background: #0b7a70; }

/* Login Form */
.auth-card {
    max-width: 450px;
    margin: 80px auto;
    background: var(--white);
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

.auth-card h2 { margin-bottom: 10px; color: var(--dark); }
.auth-card p { margin-bottom: 25px; color: #777; font-size: 14px; }

.form-group { margin-bottom: 20px; text-align: left; }
label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--dark); }
input, select, textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    transition: border-color 0.2s;
}
input:focus { outline: none; border-color: var(--primary); }

/* Dashboard & Cards */
.card {
    background: var(--white);
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

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

.subtitle {
    font-size: 14px;
    color: #777;
}

.ticket-item {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 10px;
    margin-bottom: 5px;
}

.ticket-item:hover { background: #f8fafc; }
.ticket-item:last-child { border-bottom: none; }

.ticket-info h4 { margin-bottom: 5px; color: var(--dark); }
.ticket-status {
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-open { background: #e3fcef; color: #00875a; }
.status-answered { background: #deebff; color: #0747a6; }
.status-closed { background: #f4f5f7; color: #42526e; }

/* Form Styles */
.form-title { margin-bottom: 5px; }
.form-subtitle { margin-bottom: 25px; color: #777; font-size: 14px; }
.form-actions { display: flex; gap: 15px; margin-top: 10px; }

/* Detail Styles */
.detail-header { margin-bottom: 25px; display: flex; align-items: center; gap: 15px; }
.detail-header h2 { flex: 1; }
#detail-meta { 
    font-size: 13px; 
    color: #666; 
    background: #f8fafc; 
    padding: 12px; 
    border-radius: 10px; 
    margin-bottom: 20px; 
}

/* Messages */
.message-list { margin: 25px 0; max-height: 500px; overflow-y: auto; padding-right: 10px; }
.message-bubble {
    padding: 15px 20px;
    border-radius: 15px;
    margin-bottom: 15px;
    max-width: 85%;
    position: relative;
}
.msg-user { background: #e0f7f6; align-self: flex-end; margin-left: auto; border-bottom-right-radius: 4px; }
.msg-admin { background: #f1f5f9; align-self: flex-start; border-bottom-left-radius: 4px; border-left: 4px solid var(--primary); }

.reply-box { border-top: 1px solid var(--border); padding-top: 25px; }
.reply-box label { margin-bottom: 12px; }
.reply-actions { display: flex; justify-content: flex-end; margin-top: 15px; }

/* Loading & Error */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--light);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    --admin-gradient: linear-gradient(135deg, var(--admin-teal) 0%, #2dd4bf 100%);
    --admin-shadow: 0 4px 15px rgba(13, 148, 136, 0.2);
}

.inner-loader {
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
}

.error-box { 
    background: #fff5f5; 
    color: #c53030; 
    padding: 12px; 
    border-radius: 8px; 
    margin-bottom: 20px; 
    font-size: 14px;
    border: 1px solid #fed7d7;
    display: none;
}

/* Admin Notification Bar */
#admin-notice {
    background: var(--admin-teal);
    color: white;
    padding: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    display: none;
}

#admin-notice a { color: white; text-decoration: underline; }
