/* =============================================================
   ISARD Connect - Unified Interface Styles
   ============================================================= */

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

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #fff;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.screen { animation: fadeIn 0.3s ease; }

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

/* =============================================================
   Session Header (persistent)
   ============================================================= */
.session-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    z-index: 1000;
    padding: 12px 20px;
}

.session-header + .container {
    padding-top: 80px;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.header-left .logo-small {
    font-size: 1.2em;
    font-weight: 300;
    letter-spacing: 2px;
}

.header-left .logo-small span {
    color: #e94560;
    font-weight: 600;
}

.header-center .user-info {
    color: #ccc;
    font-size: 0.95em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.session-code {
    background: rgba(233, 69, 96, 0.2);
    color: #e94560;
    padding: 6px 12px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 1em;
    letter-spacing: 1px;
}

.btn-finish {
    background: transparent;
    border: 1px solid #e94560;
    color: #e94560;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
}

.btn-finish:hover {
    background: #e94560;
    color: #fff;
}

/* =============================================================
   Welcome Screen
   ============================================================= */
.header-welcome {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    font-size: 2.5em;
    font-weight: 300;
    margin-bottom: 10px;
    letter-spacing: 3px;
}

.logo span {
    color: #e94560;
    font-weight: 600;
}

.subtitle {
    color: #888;
    font-size: 1.1em;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Recover Section */
.recover-section {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 25px 30px;
    margin-bottom: 30px;
    text-align: center;
}

.recover-section h3 {
    font-weight: 400;
    margin-bottom: 15px;
    color: #ccc;
}

.recover-form {
    display: flex;
    justify-content: center;
    gap: 10px;
    max-width: 350px;
    margin: 0 auto;
}

.recover-form input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    background: rgba(0,0,0,0.3);
    color: #fff;
    font-size: 1.1em;
    font-family: monospace;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
}

.recover-form input::placeholder {
    text-transform: none;
    letter-spacing: normal;
    color: #666;
}

/* Divider */
.divider {
    text-align: center;
    margin: 30px 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: rgba(255,255,255,0.1);
}

.divider span {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 0 20px;
    color: #666;
}

/* New Session Form */
.new-session-section {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 30px;
}

.new-session-section h2 {
    font-weight: 400;
    margin-bottom: 25px;
    text-align: center;
    color: #e94560;
}

.session-form {
    max-width: 600px;
    margin: 0 auto;
}

/* Form Elements */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #ccc;
    font-size: 0.95em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    background: rgba(0,0,0,0.3);
    color: #fff;
    font-size: 1em;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #e94560;
}

.form-group select {
    cursor: pointer;
}

.form-group select option {
    background: #1a1a2e;
    color: #fff;
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.field-hint {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.85em;
}

/* Error Messages */
.error-message {
    color: #e94560;
    background: rgba(233, 69, 96, 0.1);
    border: 1px solid rgba(233, 69, 96, 0.3);
    padding: 10px 15px;
    border-radius: 8px;
    margin: 15px 0;
    font-size: 0.9em;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #e94560 0%, #c73e54 100%);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(233, 69, 96, 0.4);
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.15);
}

.btn-large {
    width: 100%;
    padding: 16px 24px;
    font-size: 1.1em;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
}

.btn-outline {
    background: transparent;
    color: #e94560;
    border: 1px solid #e94560;
}

.btn-outline:hover {
    background: rgba(233, 69, 96, 0.1);
}

.header-buttons {
    display: flex;
    gap: 10px;
}

/* =============================================================
   Tests Menu Screen
   ============================================================= */
#screen-tests h1 {
    text-align: center;
    font-weight: 400;
    margin-bottom: 10px;
}

.section-subtitle {
    text-align: center;
    color: #888;
    margin-bottom: 30px;
}

.progress-bar {
    text-align: center;
    padding: 15px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    margin-bottom: 30px;
}

.progress-bar span {
    color: #ccc;
}

.test-section {
    margin-bottom: 40px;
}

.section-title {
    font-weight: 400;
    font-size: 1.3em;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* Test Cards */
.tests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.test-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 25px;
    transition: all 0.3s ease;
    position: relative;
}

.test-card:hover {
    transform: translateY(-3px);
    border-color: rgba(233, 69, 96, 0.3);
}

.test-card.completed {
    border-color: rgba(46, 204, 113, 0.5);
}

.test-card.simple { border-top: 3px solid #2ecc71; }
.test-card.multi { border-top: 3px solid #3498db; }
.test-card.advanced { border-top: 3px solid #9b59b6; }
.test-card.latency { border-top: 3px solid #f39c12; }
.test-card.survey { border-top: 3px solid #1abc9c; }

.test-status {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.test-status.completed {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.test-status.completed::after {
    content: '✓';
}

.test-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

.test-card.simple .test-icon { color: #2ecc71; }
.test-card.multi .test-icon { color: #3498db; }
.test-card.advanced .test-icon { color: #9b59b6; }
.test-card.latency .test-icon { color: #f39c12; }
.test-card.survey .test-icon { color: #1abc9c; }

.test-card h3 {
    font-size: 1.2em;
    font-weight: 500;
    margin-bottom: 8px;
}

.test-card .badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7em;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.test-card.simple .badge { background: rgba(46, 204, 113, 0.2); color: #2ecc71; }
.test-card.multi .badge { background: rgba(52, 152, 219, 0.2); color: #3498db; }
.test-card.advanced .badge { background: rgba(155, 89, 182, 0.2); color: #9b59b6; }
.test-card.latency .badge { background: rgba(243, 156, 18, 0.2); color: #f39c12; }
.test-card.survey .badge { background: rgba(26, 188, 156, 0.2); color: #1abc9c; }

.test-card .description {
    color: #999;
    font-size: 0.9em;
    line-height: 1.5;
    margin-bottom: 15px;
}

.test-result {
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 15px;
    font-size: 0.85em;
    color: #aaa;
    min-height: 40px;
}

.test-result.has-data {
    color: #2ecc71;
}

.test-btn {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.test-card.simple .test-btn { background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%); color: #fff; }
.test-card.multi .test-btn { background: linear-gradient(135deg, #3498db 0%, #2980b9 100%); color: #fff; }
.test-card.advanced .test-btn { background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%); color: #fff; }
.test-card.latency .test-btn { background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%); color: #fff; }
.test-card.survey .test-btn { background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%); color: #fff; }

.test-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

/* =============================================================
   Test Configuration Screen
   ============================================================= */
#screen-test-config {
    max-width: 600px;
    margin: 0 auto;
}

#screen-test-config h1 {
    text-align: center;
    font-weight: 400;
    margin-bottom: 10px;
}

.config-form {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 30px;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    gap: 15px;
}

/* =============================================================
   Test Running Screen
   ============================================================= */
#screen-test-running {
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.test-running-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.test-running-header h2 {
    font-weight: 400;
}

/* Test Config Info Bar */
.test-config-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 12px 20px;
    margin-bottom: 15px;
}

.test-config-bar .config-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.test-config-bar .config-label {
    color: #888;
    font-size: 0.85em;
}

.test-config-bar .config-value {
    color: #e94560;
    font-weight: 500;
    font-size: 0.9em;
}

.test-container {
    flex: 1;
    min-height: 500px;
    background: rgba(0,0,0,0.3);
    border-radius: 16px;
    overflow: hidden;
}

.test-container iframe {
    width: 100%;
    height: 100%;
    min-height: 500px;
    border: none;
}

/* =============================================================
   Report Screen
   ============================================================= */
.report-header {
    text-align: center;
    margin-bottom: 40px;
}

.report-header h1 {
    font-weight: 400;
    margin-bottom: 20px;
    color: #2ecc71;
}

.report-session-info {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 20px 30px;
    display: inline-block;
    text-align: left;
}

.report-session-info p {
    margin: 8px 0;
    color: #ccc;
}

.report-session-info strong {
    color: #fff;
    margin-right: 10px;
}

.report-section {
    margin-bottom: 30px;
}

.report-section h2 {
    font-weight: 400;
    font-size: 1.2em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    overflow: hidden;
}

.report-table th,
.report-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.report-table th {
    background: rgba(255,255,255,0.05);
    color: #ccc;
    font-weight: 500;
}

.report-table td {
    color: #aaa;
}

.report-table tbody tr:hover {
    background: rgba(255,255,255,0.02);
}

.report-actions {
    text-align: center;
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* =============================================================
   Modal
   ============================================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    background: #1a1a2e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
}

.modal h3 {
    margin-bottom: 15px;
    font-weight: 500;
}

.modal p {
    color: #aaa;
    margin-bottom: 25px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* =============================================================
   Responsive
   ============================================================= */
@media (max-width: 768px) {
    .logo { font-size: 2em; }

    .form-row {
        grid-template-columns: 1fr;
    }

    .header-content {
        flex-wrap: wrap;
        justify-content: center;
    }

    .header-center {
        order: 3;
        width: 100%;
        text-align: center;
        margin-top: 10px;
    }

    .tests-grid {
        grid-template-columns: 1fr;
    }

    .report-actions {
        flex-direction: column;
    }
}
