/* Ranker-specific styles that complement the main site aesthetic */

/* Header navigation */
.header-nav {
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.back-link {
    color: #666;
    text-decoration: none;
    font-size: 1rem;
}

.back-link:hover {
    text-decoration: underline;
}

.header-nav h1 {
    margin: 0;
    font-size: 2em;
    font-weight: 500;
}

/* Page management */
.page {
    display: none;
}

.page.active {
    display: block;
}

.page-content {
    max-width: 600px;
    margin: 0 auto;
}

/* Typography adjustments */
.page-content h2 {
    font-size: 1.8em;
    font-weight: 500;
    color: #000;
    margin-bottom: 15px;
    text-align: center;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
    text-align: center;
    font-size: 1.1em;
}

/* Input page styles */
#items-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    color: #333;
    font-size: 16px;
    font-family: 'Roboto Slab', serif;
    resize: vertical;
    margin-bottom: 20px;
    line-height: 1.5;
    min-height: 200px;
    box-sizing: border-box;
}

#items-input:focus {
    outline: none;
    border-color: #666;
}

#items-input::placeholder {
    color: #999;
}

/* Button styles */
button {
    padding: 12px 24px;
    background: #666;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Roboto Slab', serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

button:hover:not(:disabled):not(.choice-button) {
    background: #555;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Form styling */
#input-form {
    text-align: center;
}

/* Tier toggle styling */
.tier-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

.tier-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    color: #333;
    cursor: pointer;
    user-select: none;
}

.tier-toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: #ccc;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.tier-toggle-label input[type="checkbox"]:checked + .toggle-slider {
    background: #666;
}

.tier-toggle-label input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-text {
    font-weight: 500;
}

/* Tooltip styling */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #666;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    cursor: help;
    transition: all 0.2s ease;
}

.tooltip-icon:hover {
    background: #555;
}

.tooltip-content {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    padding: 12px 16px;
    background: #333;
    color: white;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    width: 280px;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.tooltip-content::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #333;
}

.tooltip:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
}

/* Ranking page styles */
.ranking-header h2 {
    margin-bottom: 40px;
    font-size: 1.5rem;
}

.question-pair {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.choice-button {
    padding: 30px 40px;
    background: white;
    color: #333;
    border: 2px solid #ddd;
    border-radius: 12px;
    font-size: 1.2rem;
    font-family: 'Roboto Slab', serif;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 200px;
    max-width: 280px;
    word-wrap: break-word;
    text-align: center;
    line-height: 1.4;
}

.choice-button:hover {
    background: #f8f8f8;
    border-color: #666;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.vs {
    font-size: 1.5rem;
    font-weight: 500;
    color: #999;
    margin: 0 15px;
}

.controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.nav-button {
    padding: 10px 20px;
    background: white;
    color: #666;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.nav-button:hover:not(:disabled) {
    background: #f8f8f8;
    border-color: #666;
}

.nav-button:disabled {
    background: #f5f5f5;
    color: #ccc;
    border-color: #eee;
    cursor: not-allowed;
}

.progress {
    color: #666;
    font-size: 1rem;
    text-align: center;
    flex: 1;
    margin: 0 20px;
}

/* Results page styles */
.ranking-list {
    margin-bottom: 40px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: #666;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Roboto Slab', serif;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
    position: relative;
}

.share-button:hover:not(:disabled) {
    background: #555;
    transform: translateY(-1px);
}

.share-button:disabled {
    background: #999;
    cursor: not-allowed;
    transform: none;
}

.share-button .checkmark {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.share-button.success .checkmark {
    opacity: 1;
}

.share-button.success .share-text {
    opacity: 0.8;
}


.ranking-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    margin: 10px 0;
    background: white;
    border: 2px solid #f0f0f0;
    border-radius: 8px;
    border-left: 4px solid #666;
    transition: all 0.2s ease;
}

.ranking-item:hover {
    background: #f8f8f8;
    border-color: #e0e0e0;
    cursor: pointer;
}

.ranking-item.selected {
    background: #f0f8ff;
    border-color: #4a90e2;
    border-left-color: #4a90e2;
}

.rank-number {
    font-weight: 500;
    font-size: 1.2rem;
    color: #666;
    margin-right: 20px;
    min-width: 40px;
    text-align: center;
}

.item-name {
    font-size: 1.1rem;
    text-align: left;
    flex: 1;
    color: #333;
    line-height: 1.4;
}

.new-ranking-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: #666;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Roboto Slab', serif;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
}

.new-ranking-button:hover {
    background: pink;
    transform: translateY(-1px);
}

/* Mobile responsive */
@media (max-width: 600px) {
    .header-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .page-content {
        padding: 0 20px;
    }
    
    #input-form {
        width: 100%;
        max-width: 100%;
    }
    
    #items-input {
        width: 100%;
        box-sizing: border-box;
        margin: 0 auto;
    }
    
    .question-pair {
        flex-direction: column;
        gap: 20px;
    }
    
    .vs {
        margin: 10px 0;
    }
    
    .controls {
        flex-direction: column;
        text-align: center;
    }
    
    .progress {
        margin: 0;
        order: -1;
    }
    
    .choice-button {
        min-width: 250px;
        max-width: 300px;
    }
    
    .ranking-item {
        padding: 12px 15px;
    }
    
    .rank-number {
        min-width: 35px;
        margin-right: 15px;
    }
    
    .results-actions {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .share-button,
    .new-ranking-button {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
    
    .tier-toggle-container {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .tooltip-content {
        width: 260px;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* Justification area styles */
.justification-area {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    min-height: 60px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.justification-prompt {
    color: #666;
    text-align: center;
    font-style: italic;
    padding: 10px 0;
}

.justification-header {
    color: #333;
    font-weight: 500;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.1rem;
}

.justification-step {
    color: #555;
    margin: 8px 0;
    padding: 8px 12px;
    background: white;
    border-radius: 5px;
    border-left: 3px solid #4a90e2;
    line-height: 1.4;
}

.justification-step.tier-step {
    border-left-color: #28a745;
    background: #f8fff9;
}

.justification-step.question-step {
    border-left-color: #4a90e2;
    background: white;
}

.justification-step strong {
    color: #333;
}

.justification-error {
    color: #dc3545;
    text-align: center;
    font-style: italic;
    padding: 10px 0;
}

/* Additional styling for better visual hierarchy */
@media (max-width: 480px) {
    .header-nav h1 {
        font-size: 1.8em;
    }
    
    .page-content h2 {
        font-size: 1.5em;
    }
    
    .choice-button {
        font-size: 1.1rem;
        padding: 25px 30px;
    }
    
    .justification-area {
        margin: 20px 0;
        padding: 15px;
    }
    
    .justification-header {
        font-size: 1rem;
    }
    
    .justification-step {
        font-size: 0.9rem;
        padding: 6px 10px;
    }
}
