:root {
    --primary-color: #4A90E2;
    --secondary-color: #50C878;
    --danger-color: #E74C3C;
    --warning-color: #F39C12;
    --light-gray: #F5F7FA;
    --medium-gray: #E1E8ED;
    --dark-gray: #657786;
    --text-primary: #14171A;
    --text-secondary: #657786;
    --border-radius: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

* {
    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;
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* Header Styles */
.header {
    text-align: center;
    color: white;
    padding: 40px 20px;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.header p {
    font-size: 1.2em;
    opacity: 0.95;
}

/* Card Styles */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 30px;
    margin-bottom: 20px;
}

/* Family Member Selection Grid */
.family-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.family-member-btn {
    background: white;
    border: 3px solid var(--medium-gray);
    border-radius: var(--border-radius);
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.family-member-btn:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.family-member-btn.completed {
    border-color: var(--secondary-color);
    background: linear-gradient(135deg, #f5fff9 0%, #e8f8ef 100%);
}

.family-member-name {
    font-size: 1.8em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.family-member-weight {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.completion-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--secondary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    margin-top: 10px;
}

.completion-badge::before {
    content: '✓';
    font-size: 1.2em;
}

/* Criteria Selection */
.criteria-section {
    margin-bottom: 40px;
}

.criteria-section h2 {
    color: var(--primary-color);
    font-size: 1.5em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--medium-gray);
}

.criteria-list {
    display: grid;
    gap: 12px;
}

.criteria-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: var(--light-gray);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.criteria-item:hover {
    background: #e8eef3;
    transform: translateX(5px);
}

.criteria-item.selected {
    background: #e3f2fd;
    border-color: var(--primary-color);
}

.criteria-item input[type="checkbox"] {
    width: 24px;
    height: 24px;
    margin-right: 15px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.criteria-item label {
    flex: 1;
    cursor: pointer;
    font-size: 1.05em;
    user-select: none;
}

/* Rating Page */
.rating-container {
    max-width: 800px;
    margin: 0 auto;
}

.progress-bar {
    background: var(--light-gray);
    height: 30px;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 30px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9em;
}

.rating-item {
    background: white;
    border: 2px solid var(--medium-gray);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.rating-item.rated {
    border-color: var(--secondary-color);
    background: #fafffe;
}

.rating-header {
    margin-bottom: 20px;
}

.rating-item-name {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.category-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 500;
}

.rating-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.rating-btn {
    padding: 20px;
    border: 3px solid;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1em;
    font-weight: 600;
    text-align: center;
}

.rating-btn:hover {
    transform: scale(1.05);
}

.rating-btn.rating-1 {
    border-color: #90CAF9;
    color: #1976D2;
}

.rating-btn.rating-1:hover,
.rating-btn.rating-1.selected {
    background: #E3F2FD;
    border-color: #1976D2;
}

.rating-btn.rating-2 {
    border-color: #FFB74D;
    color: #F57C00;
}

.rating-btn.rating-2:hover,
.rating-btn.rating-2.selected {
    background: #FFF3E0;
    border-color: #F57C00;
}

.rating-btn.rating-3 {
    border-color: #E57373;
    color: #C62828;
}

.rating-btn.rating-3:hover,
.rating-btn.rating-3.selected {
    background: #FFEBEE;
    border-color: #C62828;
    font-weight: 700;
}

.rating-label {
    display: block;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.rating-number {
    display: block;
    font-size: 0.9em;
    opacity: 0.7;
}

/* Buttons */
.btn {
    padding: 15px 40px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #357ABD;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-primary:disabled {
    background: var(--medium-gray);
    cursor: not-allowed;
    transform: none;
}

.btn-success {
    background: var(--secondary-color);
    color: white;
}

.btn-success:hover {
    background: #45b369;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: var(--light-gray);
    color: var(--text-primary);
    border: 2px solid var(--medium-gray);
}

.btn-secondary:hover {
    background: var(--medium-gray);
}

.btn-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

/* Results Page */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--medium-gray);
    flex-wrap: wrap;
}

.tab-btn {
    padding: 15px 30px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.member-summary {
    background: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 25px;
    border-left: 5px solid var(--primary-color);
}

.member-summary h3 {
    font-size: 1.5em;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.priority-section {
    margin-bottom: 20px;
}

.priority-section h4 {
    font-size: 1.2em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.priority-section.dealbreaker h4 {
    color: #C62828;
}

.priority-section.important h4 {
    color: #F57C00;
}

.priority-section.nice-to-have h4 {
    color: #1976D2;
}

.priority-section ul {
    list-style: none;
    padding-left: 0;
}

.priority-section li {
    padding: 8px 15px;
    background: white;
    margin-bottom: 5px;
    border-radius: 6px;
    border-left: 3px solid currentColor;
}

.weighted-results {
    margin-top: 20px;
}

.tier {
    margin-bottom: 30px;
}

.tier h3 {
    font-size: 1.4em;
    margin-bottom: 15px;
    padding: 15px;
    border-radius: 8px;
    color: white;
}

.tier.dealbreakers h3 {
    background: linear-gradient(135deg, #C62828, #E57373);
}

.tier.important h3 {
    background: linear-gradient(135deg, #F57C00, #FFB74D);
}

.tier.nice-to-have h3 {
    background: linear-gradient(135deg, #1976D2, #90CAF9);
}

.tier-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: white;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid;
}

.tier.dealbreakers .tier-item {
    border-left-color: #C62828;
}

.tier.important .tier-item {
    border-left-color: #F57C00;
}

.tier.nice-to-have .tier-item {
    border-left-color: #1976D2;
}

.tier-item-name {
    font-weight: 600;
    flex: 1;
}

.tier-item-score {
    font-size: 1.3em;
    font-weight: 700;
    padding: 5px 15px;
    border-radius: 20px;
    background: var(--light-gray);
}

.consensus-section {
    margin-bottom: 30px;
    padding: 20px;
    border-radius: var(--border-radius);
}

.consensus-section.strong {
    background: linear-gradient(135deg, #e8f8ef 0%, #f5fff9 100%);
    border: 2px solid var(--secondary-color);
}

.consensus-section.differences {
    background: linear-gradient(135deg, #fff3e0 0%, #fff8e1 100%);
    border: 2px solid var(--warning-color);
}

.consensus-section.not-important {
    background: var(--light-gray);
    border: 2px solid var(--medium-gray);
}

.consensus-section h3 {
    font-size: 1.3em;
    margin-bottom: 15px;
}

.consensus-item {
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
}

.difference-breakdown {
    padding-left: 20px;
    margin-top: 10px;
    font-size: 0.95em;
    color: var(--text-secondary);
}

.export-section {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: var(--border-radius);
    margin-top: 30px;
}

.export-section h3 {
    margin-bottom: 15px;
}

#exportText {
    width: 100%;
    min-height: 300px;
    padding: 15px;
    border: 2px solid var(--medium-gray);
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.95em;
    margin: 20px 0;
    background: white;
}

/* Success Message */
.success-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px 60px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    text-align: center;
    z-index: 1000;
    display: none;
}

.success-message.show {
    display: block;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.success-icon {
    font-size: 4em;
    color: var(--secondary-color);
    margin-bottom: 20px;
}

.success-message h2 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.success-message p {
    color: var(--text-secondary);
    font-size: 1.1em;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2em;
    }
    
    .header p {
        font-size: 1em;
    }
    
    .family-grid {
        grid-template-columns: 1fr;
    }
    
    .rating-buttons {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        width: 100%;
        text-align: left;
    }
    
    .btn-container {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .tier-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 20px;
    }
    
    .family-member-name {
        font-size: 1.5em;
    }
    
    .rating-item {
        padding: 15px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .btn, .tabs, .export-section {
        display: none;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
