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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }
    
    header p {
        font-size: 0.9em;
    }
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.filter-section {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.filter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.filter-group label {
    font-weight: 600;
    color: #495057;
    font-size: 1.1em;
}

.filter-group select,
.filter-group input[type="text"],
.filter-group input[type="date"] {
    padding: 10px 15px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 1em;
    min-width: 150px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-group input[type="text"] {
    min-width: 250px;
}

.filter-group select:hover,
.filter-group input:hover {
    border-color: #667eea;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-group {
    flex: 1;
    min-width: 300px;
}

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

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-1px);
}

.btn:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    transform: none;
}

.download-icon {
    font-size: 1.1em;
}

.stats {
    font-weight: 600;
    font-size: 1.1em;
    color: #667eea;
    display: flex;
    gap: 20px;
    align-items: center;
}

.selection-section {
    padding: 15px 20px;
    background: #e3f2fd;
    border-bottom: 2px solid #e9ecef;
}

.selection-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #495057;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.selected-count {
    font-weight: 600;
    color: #28a745;
}

.download-options {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.download-options .checkbox-label {
    font-size: 0.9em;
}

/* Response card selection styling */
.response-card.selected {
    border-color: #28a745;
    background: #f8fff8;
}

.response-card .selection-checkbox {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    z-index: 10;
}

/* Fix checkbox overlap with timezone text on desktop */
@media (min-width: 768px) {
    .response-card .response-header {
        padding-right: 35px; /* Make space for checkbox */
    }
}

.responses-list {
    padding: 40px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-size: 1.1em;
}

.response-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.response-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

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

.response-id {
    font-weight: 700;
    font-size: 1.3em;
    color: #667eea;
}

.response-date {
    color: #6c757d;
    font-size: 0.95em;
}

.response-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 0.85em;
    color: #6c757d;
    margin-bottom: 4px;
    font-weight: 600;
}

.info-value {
    color: #212529;
    font-size: 1em;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: #fefefe;
    margin: 2% auto;
    padding: 0;
    border-radius: 12px;
    width: 95%;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

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

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    padding: 20px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover,
.close:focus {
    color: #667eea;
}

#responseDetail {
    padding: 40px;
}

.detail-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    margin: -40px -40px 30px -40px;
    border-radius: 12px 12px 0 0;
}

.detail-header h2 {
    font-size: 2em;
    margin-bottom: 10px;
}

.detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.survey-section {
    margin-bottom: 40px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.section-title {
    background: #f8f9fa;
    padding: 20px;
    font-size: 1.5em;
    font-weight: 700;
    color: #495057;
    border-bottom: 2px solid #e9ecef;
}

.section-content {
    padding: 25px;
}

.question-block {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #e9ecef;
}

.question-block:last-child {
    border-bottom: none;
}

.question-title {
    font-weight: 600;
    color: #495057;
    margin-bottom: 10px;
    font-size: 1.05em;
}

.answer {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 6px;
    border-left: 4px solid #667eea;
    font-size: 1em;
    color: #212529;
}

.answer.empty {
    color: #adb5bd;
    font-style: italic;
}

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

.answer-list li {
    background: #f8f9fa;
    padding: 8px 16px;
    margin-bottom: 8px;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

    .filter-section {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .response-info {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 5% auto;
    }

    #responseDetail {
        padding: 20px;
    }

    .detail-header {
        margin: -20px -20px 20px -20px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .container {
        box-shadow: none;
    }

    .filter-section,
    .close {
        display: none;
    }

    .modal-content {
        margin: 0;
        max-height: none;
        box-shadow: none;
    }
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .container {
        border-radius: 8px;
        margin: 0;
    }
    
    .filter-section {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
        gap: 10px;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .filter-group label {
        font-size: 0.9em;
        margin-bottom: 5px;
    }
    
    select {
        width: 100%;
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .responses-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }
    
    .response-card {
        padding: 15px;
    }
    
    .response-card h3 {
        font-size: 1.1em;
    }
    
    .response-card .meta {
        font-size: 0.85em;
    }
    
    .response-detail {
        padding: 15px;
    }
    
    .survey-section {
        margin-bottom: 20px;
    }
    
    .section-title {
        font-size: 1.1em;
        padding: 10px 15px;
    }
    
    .question-item {
        padding: 10px 15px;
    }
    
    .question-label {
        font-size: 0.9em;
        margin-bottom: 5px;
    }
    
    .question-answer {
        font-size: 0.9em;
    }
    
    /* Signature images mobile optimization */
    .question-answer img {
        max-width: 100% !important;
        height: auto !important;
        max-height: 150px !important;
        border-radius: 4px;
        margin: 5px 0;
    }
    
    /* Multi-select answers mobile */
    .answer-list {
        padding-left: 15px;
    }
    
    .answer-list li {
        margin-bottom: 3px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    header {
        padding: 15px;
    }
    
    header h1 {
        font-size: 1.5em;
    }
    
    .filter-section {
        padding: 10px;
    }
    
    .responses-grid {
        padding: 10px;
        gap: 10px;
    }
    
    .response-card {
        padding: 12px;
    }
    
    .response-detail {
        padding: 10px;
    }
    
    .question-item {
        padding: 8px 12px;
    }
    
    /* Signature images for very small screens */
    .question-answer img {
        max-height: 120px !important;
    }
}

/* User info styles */
.user-info {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 10px;
}

.user-info span {
    color: white;
    font-weight: 500;
}

/* Admin section styles */
.admin-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #3498db;
}

.admin-controls {
    margin-bottom: 20px;
}

.admin-controls button {
    margin-right: 10px;
}

.admin-list {
    background: white;
    border-radius: 4px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.admin-table th,
.admin-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.admin-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.admin-table tr:hover {
    background: #f8f9fa;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
    margin-right: 5px;
}

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

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #219a52;
}

.btn-info {
    background: #3498db;
    color: white;
}

.btn-info:hover {
    background: #2980b9;
}

/* Invite codes section styles */
.invite-codes-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.invite-codes-info h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.invite-codes-info h4 {
    color: #34495e;
    margin: 20px 0 10px 0;
    font-size: 1.1em;
}

.invite-codes-info p {
    color: #7f8c8d;
    margin-bottom: 20px;
}

.invite-code-pattern code {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Monaco', 'Consolas', monospace;
    color: #e74c3c;
    font-weight: 600;
}

.registration-flow ol {
    padding-left: 20px;
    color: #2c3e50;
}

.registration-flow li {
    padding: 5px 0;
    margin: 5px 0;
}

/* Admin list enhancements */
.admin-note {
    color: #7f8c8d;
    font-size: 0.9em;
    margin-bottom: 15px;
    padding: 10px;
    background: #ecf0f1;
    border-radius: 4px;
    border-left: 3px solid #3498db;
}

.status-active {
    color: #27ae60;
    font-weight: 600;
}

.status-inactive {
    color: #e74c3c;
    font-weight: 600;
}

.action-buttons {
    white-space: nowrap;
}

.action-buttons button {
    margin: 2px;
}

/* Responsive admin table */
@media (max-width: 768px) {
    .admin-table {
        font-size: 0.85em;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 6px 8px;
    }
    
    .btn-sm {
        padding: 3px 6px;
        font-size: 11px;
    }
    
    .admin-controls {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .admin-controls button {
        margin-right: 0;
        width: 100%;
    }
}

