/* Apple-style, clean UI for Survey System */

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

body {
    font-family: 'Anuphan', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f7;
    min-height: 100vh;
    padding: 20px;
    color: #1d1d1f;
    line-height: 1.47059;
    font-weight: 400;
    letter-spacing: -0.022em;
}

.container {
    max-width: 680px;
    margin: 0 auto;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 2px;
    margin-bottom: 32px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #007aff;
    transition: width 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
    border-radius: 2px;
}

/* Survey Card */
.survey-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 48px 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.step-indicator {
    font-size: 13px;
    color: #86868b;
    font-weight: 500;
    margin-bottom: 24px;
    text-align: center;
    letter-spacing: -0.01em;
}

.question-title {
    font-size: 24px;
    font-weight: 700;
    color: #000000;
    margin-bottom: 20px;
    text-align: center;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.question-helper {
    font-size: 17px;
    color: #666666;
    text-align: center;
    margin-bottom: 40px;
    line-height: 1.6;
    letter-spacing: -0.01em;
}

/* Answer Container */
.answer-container {
    margin-bottom: 40px;
}

/* Option Buttons (Single Choice) */
.option-button {
    display: block;
    width: 100%;
    margin-bottom: 12px;
    cursor: pointer;
}

.option-button input[type="radio"] {
    display: none;
}

.option-button span {
    display: block;
    padding: 18px 24px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    text-align: center;
    font-size: 17px;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
    color: #1a1a1a;
    letter-spacing: -0.01em;
    line-height: 1.5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.option-button:hover span {
    background: #f8f8f8;
    border-color: #007aff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.15);
}

.option-button:active span {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 122, 255, 0.2);
}

.option-button input[type="radio"]:checked + span {
    background: #007aff;
    color: #ffffff;
    border-color: #007aff;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
    transform: translateY(-1px);
}

/* Scale Container */
.scale-container {
    margin: 24px 0;
}

.scale-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 13px;
    color: #86868b;
    letter-spacing: -0.01em;
}

.scale-options {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.scale-button {
    flex: 1;
    cursor: pointer;
}

.scale-button input[type="radio"] {
    display: none;
}

.scale-button span {
    display: block;
    padding: 18px 14px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
    color: #1a1a1a;
    letter-spacing: -0.01em;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.scale-button:hover span {
    background: #f8f8f8;
    border-color: #007aff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.15);
}

.scale-button:active span {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 122, 255, 0.2);
}

.scale-button input[type="radio"]:checked + span {
    background: #007aff;
    color: #ffffff;
    border-color: #007aff;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
    transform: translateY(-1px);
}

/* Ranking Container */
.ranking-container {
    margin: 24px 0;
}

.ranking-instruction {
    background: #e3f2fd;
    border: 2px solid #2196f3;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    color: #1565c0;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.instruction-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.instruction-text {
    flex: 1;
}

.sortable-list {
    list-style: none;
    padding: 0;
}

.sortable-item {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    margin-bottom: 14px;
    cursor: grab;
    transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    position: relative;
    touch-action: pan-y;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.sortable-item:hover {
    background: #f5f5f5;
    border-color: #007aff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
}

.sortable-item:active {
    cursor: grabbing;
}

.sortable-item.dragging {
    opacity: 0.8;
    background: #007aff;
    color: #fff;
    border-color: #0051d5;
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.4);
    transform: scale(1.02) rotate(1deg);
    z-index: 1000;
}

.sortable-item.dragging .item-text {
    color: #ffffff;
}

.sortable-item.dragging .drag-handle {
    color: #ffffff;
}

.drag-handle {
    font-size: 24px;
    margin-right: 20px;
    color: #86868b;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    cursor: grab;
    transition: color 0.2s;
    -webkit-touch-callout: none;
    pointer-events: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.sortable-item:hover .drag-handle {
    color: #007aff;
}

.item-text {
    flex: 1;
    font-size: 17px;
    font-weight: 500;
    color: #1a1a1a;
    letter-spacing: -0.01em;
    line-height: 1.5;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    pointer-events: none;
}

.sortable-item.touch-active {
    background: #f0f0f0;
    border-color: #007aff;
}

@media (max-width: 768px) {
    .sortable-item {
        padding: 18px 20px;
    }
    
    .item-text {
        font-size: 16px;
    }
    
    .ranking-instruction {
        font-size: 15px;
        padding: 14px 18px;
    }
    
    .instruction-icon {
        font-size: 22px;
    }
}

/* Drag over state */
.sortable-item.drag-over {
    border-color: #007aff;
    border-style: dashed;
    background: #e3f2fd;
    transform: scale(1.02);
}

/* Drag placeholder */
.sortable-item.sortable-ghost {
    opacity: 0.4;
    background: #e0e0e0;
    border: 2px dashed #007aff;
}

/* Text Input */
.text-input {
    width: 100%;
    padding: 18px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    font-size: 17px;
    font-family: inherit;
    background: #ffffff;
    color: #1a1a1a;
    resize: vertical;
    transition: all 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
    letter-spacing: -0.01em;
    line-height: 1.6;
    font-weight: 400;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.text-input:focus {
    outline: none;
    border-color: #007aff;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15), 0 4px 12px rgba(0, 122, 255, 0.1);
    transform: translateY(-1px);
}

.text-input::placeholder {
    color: #999999;
    font-weight: 400;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.btn {
    flex: 1;
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    text-decoration: none;
    display: inline-block;
    text-align: center;
    letter-spacing: -0.016em;
    font-family: inherit;
}

.btn-primary {
    background: #007aff;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.15);
}

.btn-primary:hover:not(:disabled) {
    background: #0051d5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.25);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #007aff;
}

.btn-secondary {
    background: #f5f5f7;
    color: #1d1d1f;
    border: 0.5px solid rgba(0, 0, 0, 0.08);
}

.btn-secondary:hover {
    background: #e8e8ed;
    border-color: rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Thanks Page */
.thanks-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 64px 40px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.04), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
    border: 0.5px solid rgba(0, 0, 0, 0.04);
    text-align: center;
}

.thanks-icon {
    width: 88px;
    height: 88px;
    background: #007aff;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    margin: 0 auto 32px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.2);
}

.thanks-card h1 {
    font-size: 32px;
    margin-bottom: 16px;
    color: #1d1d1f;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.125;
}

.thanks-card p {
    font-size: 17px;
    color: #86868b;
    margin-bottom: 32px;
    letter-spacing: -0.016em;
    line-height: 1.47059;
}

/* Admin Styles */
body {
    font-family: 'Anuphan', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px;
    font-family: 'Anuphan', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.admin-header {
    background: #ffffff;
    padding: 20px 24px;
    border-radius: 16px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.admin-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-title {
    font-size: 24px;
    font-weight: 700;
    color: #000000;
    letter-spacing: -0.01em;
    margin: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #ffffff;
    padding: 24px;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.stat-label {
    font-size: 15px;
    color: #666666;
    margin-bottom: 12px;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: #007aff;
    letter-spacing: -0.02em;
}

.section-header {
    margin: 48px 0 24px 0;
    padding-bottom: 16px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.section-title {
    font-size: 28px;
    font-weight: 700;
    color: #000000;
    letter-spacing: -0.02em;
    margin: 0;
}

.questions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 1024px) {
    .questions-grid {
        grid-template-columns: 1fr;
    }
}

.table-container {
    background: #ffffff;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: 0;
    overflow: visible;
}

.table-container h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
    color: #000000;
    letter-spacing: -0.01em;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.chart-wrapper {
    margin-bottom: 24px;
    padding: 0;
}

.chart-container {
    height: 300px;
    position: relative;
    padding: 16px;
    background: #fafafa;
    border-radius: 12px;
    border: 1px solid #e8e8e8;
}

.table-wrapper {
    margin-top: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.search-form {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: 'Anuphan', inherit;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #007aff;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 0;
    min-width: 500px;
}

table th,
table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e8e8e8;
    font-size: 14px;
    letter-spacing: -0.01em;
}

table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #1a1a1a;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

table tbody tr {
    transition: background-color 0.2s;
}

table tbody tr:hover {
    background: #f8f9fa;
}

table tbody tr:last-child td {
    border-bottom: none;
}

table td {
    color: #333333;
    font-weight: 400;
}

table td:first-child {
    font-weight: 500;
    color: #1a1a1a;
}

table td:last-child {
    text-align: right;
    font-weight: 600;
    color: #007aff;
}

/* Login Form */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    background: #fff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #1a1a1a;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

/* Welcome Page */
.welcome-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.welcome-header {
    width: 100%;
    background: #f5f5f7;
    padding: 0;
    text-align: center;
}

.cover-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
}

.survey-header {
    width: 100%;
    text-align: center;
    margin-bottom: 32px;
    padding: 0;
}

.survey-cover-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.welcome-content {
    padding: 48px 40px;
}

.welcome-title {
    font-size: 26px;
    font-weight: 700;
    color: #000000;
    margin-bottom: 24px;
    text-align: center;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.welcome-description {
    margin-bottom: 40px;
    text-align: left;
}

.welcome-description p {
    font-size: 16px;
    color: #333333;
    line-height: 1.7;
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}

.welcome-note {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 16px 20px;
    border-radius: 8px;
    font-size: 16px;
    color: #1565c0;
    font-weight: 500;
    margin-top: 24px;
}

.btn-large {
    width: 100%;
    padding: 18px 28px;
    font-size: 17px;
    font-weight: 600;
}

/* Footer */
.site-footer {
    margin-top: 60px;
    padding: 24px 20px;
    text-align: center;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.footer-content {
    max-width: 680px;
    margin: 0 auto;
}

.footer-content p {
    font-size: 14px;
    color: #86868b;
    margin: 0;
    letter-spacing: -0.01em;
}

.footer-content a {
    color: #007aff;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.footer-content a:hover {
    color: #0051d5;
    text-decoration: underline;
}

/* Responsive */
@media (min-width: 768px) {
    body {
        padding: 40px 20px;
    }
    
    .survey-card {
        padding: 56px 48px;
    }
    
    .question-title {
        font-size: 28px;
    }
    
    .option-button span {
        font-size: 18px;
        padding: 20px 28px;
    }
    
    .scale-button span {
        font-size: 22px;
        padding: 20px 16px;
    }
    
    .item-text {
        font-size: 18px;
    }
    
    .text-input {
        font-size: 18px;
        padding: 20px 24px;
    }
    
    .scale-options {
        gap: 12px;
    }
    
    .thanks-card {
        padding: 80px 60px;
    }
    
    .thanks-card h1 {
        font-size: 28px;
    }
    
    .welcome-content {
        padding: 56px 60px;
    }
    
    .welcome-title {
        font-size: 32px;
    }
    
    .welcome-description p {
        font-size: 17px;
    }
    
    .btn-large {
        font-size: 18px;
        padding: 20px 32px;
    }
    
    /* Admin Desktop */
    .admin-container {
        padding: 32px;
    }
    
    .admin-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 28px 32px;
    }
    
    .admin-title {
        font-size: 28px;
    }
    
    .admin-actions {
        flex-direction: row;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }
    
    .table-container {
        padding: 32px;
    }
    
    .chart-container {
        height: 350px;
        padding: 24px;
    }
    
    table th,
    table td {
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* Admin Mobile Responsive */
@media (max-width: 767px) {
    .admin-container {
        padding: 12px;
    }
    
    .admin-header {
        padding: 16px 20px;
    }
    
    .admin-title {
        font-size: 20px;
    }
    
    .admin-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .admin-actions .btn {
        width: 100%;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    .table-container {
        padding: 16px;
        margin-bottom: 20px;
    }
    
    .table-container h2 {
        font-size: 18px;
        margin-bottom: 20px;
    }
    
    .chart-container {
        height: 250px;
        padding: 12px;
    }
    
    table th,
    table td {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-input {
        width: 100%;
        min-width: auto;
    }
}

