/* ============================================
   SurveyPro - Modern Survey Platform CSS
   ============================================ */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --accent: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #0f172a;
    --dark-light: #1e293b;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --white: #ffffff;
    --gradient-1: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
    --gradient-2: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
    --shadow-glow: 0 0 30px rgba(99,102,241,0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    color: var(--dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============ Navbar ============ */
.navbar {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 0.8rem 0;
    z-index: 1050;
    transition: all 0.3s ease;
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.4rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar .nav-link {
    color: rgba(255,255,255,0.8) !important;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
}

.navbar .nav-link:hover {
    color: white !important;
    background: rgba(255,255,255,0.1);
}

/* ============ Main Content ============ */
.main-content {
    flex: 1;
    padding-top: 80px;
}

/* ============ Flash Messages ============ */
.flash-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1060;
    max-width: 400px;
}

.flash-alert {
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.4s ease;
    font-weight: 500;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============ Cards ============ */
.card-glass {
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.card-glass:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-dark {
    background: var(--dark-light);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
    color: white;
}

/* ============ Buttons ============ */
.btn-primary-gradient {
    background: var(--gradient-1);
    border: none;
    color: white;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.btn-primary-gradient:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    color: white;
}

.btn-outline-primary-custom {
    border: 2px solid var(--primary);
    color: var(--primary);
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius-sm);
    background: transparent;
    transition: all 0.3s ease;
}

.btn-outline-primary-custom:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* ============ Hero Section ============ */
.hero-section {
    background: var(--gradient-2);
    padding: 100px 0 80px;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(99,102,241,0.15) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(6,182,212,0.1) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(1deg); }
    66% { transform: translate(-20px, 20px) rotate(-1deg); }
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    color: white;
    line-height: 1.2;
    position: relative;
}

.hero-title span {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--gray-400);
    line-height: 1.8;
    position: relative;
}

/* ============ Feature Cards ============ */
.feature-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    transition: all 0.4s ease;
    border: 1px solid var(--gray-200);
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.feature-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.2rem;
    font-size: 1.8rem;
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 8px 25px rgba(99,102,241,0.3);
}

.feature-card h5 {
    font-weight: 700;
    margin-bottom: 0.8rem;
    color: var(--dark);
}

.feature-card p {
    color: var(--gray-500);
    font-size: 0.95rem;
}

/* ============ How It Works ============ */
.step-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.3rem;
    margin: 0 auto 1rem;
    box-shadow: 0 8px 25px rgba(99,102,241,0.3);
}

/* ============ Auth Pages ============ */
.auth-container {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 3rem;
    max-width: 440px;
    width: 100%;
}

.auth-card h2 {
    font-weight: 800;
    text-align: center;
    margin-bottom: 0.5rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============ Form Controls ============ */
.form-control-custom {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: var(--gray-100);
}

.form-control-custom:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
    background: white;
}

.form-label-custom {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* ============ Dashboard ============ */
.survey-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.survey-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-1);
}

.survey-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.survey-card .badge {
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.badge-published {
    background: rgba(16,185,129,0.1);
    color: var(--success);
}

.badge-draft {
    background: rgba(245,158,11,0.1);
    color: var(--warning);
}

.survey-meta {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.survey-meta i { margin-right: 0.3rem; }

/* ============ Survey Builder ============ */
.question-card {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    position: relative;
}

.question-card:hover {
    border-color: var(--primary-light);
}

.question-card.dragging {
    opacity: 0.5;
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.question-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.question-number {
    background: var(--gradient-1);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.question-type-select {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--gray-100);
    cursor: pointer;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.option-row .form-control {
    flex: 1;
}

.btn-remove-option {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.btn-remove-option:hover {
    background: rgba(239,68,68,0.1);
}

/* ============ Public Survey ============ */
.survey-public-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.survey-public-header {
    text-align: center;
    padding: 2.5rem 2rem;
    border-radius: var(--radius-xl);
    margin-bottom: 2rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.survey-public-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.2), transparent);
}

.survey-public-header h1 {
    font-weight: 800;
    font-size: 1.8rem;
    position: relative;
}

.survey-public-header p {
    opacity: 0.9;
    position: relative;
}

.public-question-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
}

.public-question-card:hover {
    box-shadow: var(--shadow-md);
}

.public-question-text {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 1rem;
    color: var(--dark);
}

.public-question-text .badge {
    font-size: 0.7rem;
    vertical-align: middle;
}

/* Star Rating */
.star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 0.3rem;
}

.star-rating input {
    display: none;
}

.star-rating label {
    cursor: pointer;
    font-size: 2rem;
    color: var(--gray-300);
    transition: all 0.2s ease;
}

.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
    color: #fbbf24;
    transform: scale(1.1);
}

/* Likert Scale */
.likert-scale {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.likert-option {
    flex: 1;
    min-width: 80px;
}

.likert-option input { display: none; }

.likert-option label {
    display: block;
    text-align: center;
    padding: 0.8rem 0.5rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    background: white;
}

.likert-option input:checked + label {
    border-color: var(--primary);
    background: rgba(99,102,241,0.1);
    color: var(--primary);
    font-weight: 700;
}

.likert-option label:hover {
    border-color: var(--primary-light);
    background: rgba(99,102,241,0.05);
}

/* Radio & Checkbox */
.option-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.option-item:hover {
    border-color: var(--primary-light);
    background: rgba(99,102,241,0.03);
}

.option-item.selected {
    border-color: var(--primary);
    background: rgba(99,102,241,0.08);
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
}

.option-item .option-text {
    flex: 1;
    font-size: 0.95rem;
}

/* Other Text Input */
.other-text-input {
    margin-top: 0.3rem;
    margin-left: 2.2rem;
    display: none;
}

.other-text-input.show {
    display: block;
}

/* Progress Bar */
.progress-bar-custom {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 2rem;
    position: sticky;
    top: 70px;
    z-index: 100;
}

.progress-bar-fill {
    height: 100%;
    background: var(--gradient-1);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ============ Share Page ============ */
.qr-container {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.qr-container img {
    border-radius: var(--radius-md);
    margin: 1rem 0;
}

.share-link-box {
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.share-link-box input {
    flex: 1;
    border: none;
    background: none;
    font-size: 0.9rem;
    color: var(--dark);
}

.share-link-box input:focus {
    outline: none;
}

/* ============ Reports ============ */
.report-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.report-card h6 {
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--gradient-1);
    color: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
}

.stat-card .stat-number {
    font-size: 2.5rem;
    font-weight: 800;
}

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

.bar-chart-item {
    margin-bottom: 0.8rem;
}

.bar-chart-label {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    display: flex;
    justify-content: space-between;
}

.bar-chart-bar {
    height: 28px;
    background: var(--gray-100);
    border-radius: 14px;
    overflow: hidden;
}

.bar-chart-fill {
    height: 100%;
    background: var(--gradient-1);
    border-radius: 14px;
    min-width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    transition: width 1s ease;
}

/* Star distribution */
.star-dist-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.star-dist-label {
    width: 30px;
    text-align: right;
    font-weight: 600;
    color: var(--gray-500);
}

.star-dist-bar {
    flex: 1;
    height: 20px;
    background: var(--gray-100);
    border-radius: 10px;
    overflow: hidden;
}

.star-dist-fill {
    height: 100%;
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    border-radius: 10px;
    transition: width 1s ease;
}

.star-dist-count {
    width: 40px;
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* ============ Admin ============ */
.admin-table {
    border-collapse: separate;
    border-spacing: 0;
}

.admin-table thead th {
    background: var(--dark);
    color: white;
    font-weight: 600;
    padding: 1rem;
    border: none;
}

.admin-table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.admin-table thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }

.admin-table tbody td {
    padding: 0.8rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-200);
}

.admin-table tbody tr:hover {
    background: rgba(99,102,241,0.03);
}

/* ============ Footer ============ */
.footer {
    background: var(--dark);
    color: var(--gray-400);
    padding: 1.5rem 0;
    font-size: 0.9rem;
    margin-top: auto;
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
    .hero-title { font-size: 2.2rem; }
    .hero-subtitle { font-size: 1rem; }
    .auth-card { padding: 2rem 1.5rem; }
    .survey-public-header h1 { font-size: 1.4rem; }
    .likert-scale { flex-direction: column; }
    .likert-option { min-width: 100%; }
    .star-rating label { font-size: 1.6rem; }
    .stat-card .stat-number { font-size: 2rem; }
    .flash-container { max-width: calc(100% - 40px); left: 20px; right: 20px; }
}

@media (max-width: 576px) {
    .hero-section { padding: 60px 0 40px; }
    .main-content { padding-top: 70px; }
    .question-header { flex-wrap: wrap; }
}

/* ============ Utility ============ */
.text-gradient {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-primary {
    background: var(--gradient-1);
}

.section-title {
    font-weight: 800;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    color: var(--gray-500);
    text-align: center;
    margin-bottom: 3rem;
    font-size: 1.05rem;
}

/* Color theme page */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.color-picker-wrapper input[type="color"] {
    width: 50px;
    height: 40px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 2px;
}

/* Thanks page */
.thanks-container {
    min-height: calc(100vh - 160px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.thanks-card {
    text-align: center;
    padding: 3rem;
    max-width: 500px;
}

.thanks-icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
    animation: bounceIn 0.8s ease;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Emoji support */
.emoji-text {
    font-size: 1.1em;
    line-height: 1.8;
}

/* Survey closed */
.closed-container {
    min-height: calc(100vh - 160px);
    display: flex;
    align-items: center;
    justify-content: center;
}
