/* General Body Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    color: #1c1e21;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    background: #ffffff;
    padding: 25px 40px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

/* Navigation Bar */
.nav-bar {
    background-color: #2c3e50;
    padding: 10px 0;
    margin-bottom: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.nav-bar .menu {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}
.nav-links {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}
.nav-links li a {
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    font-weight: 600;
    border-radius: 6px;
    transition: background-color 0.3s;
    white-space: nowrap;
}
.nav-links li a:hover {
    background-color: #34495e;
}
.nav-links li a.active {
    background-color: #42b983;
}

/* Header */
.header {
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 20px;
    margin-bottom: 25px;
}
.header h1 {
    font-size: 2.2em;
    color: #2c3e50;
    margin: 0;
}
.version-badge {
    background-color: #42b983;
    color: white;
    font-size: 0.5em;
    padding: 4px 8px;
    border-radius: 6px;
    vertical-align: middle;
}
.subtitle {
    font-size: 1.1em;
    color: #555;
    margin-top: 8px;
}

/* Form Grid Layout */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

/* Form Group */
.form-group {
    display: flex;
    flex-direction: column;
}
.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}
select, textarea, input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
    background-color: #f9f9f9;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}
select:focus, textarea:focus, input[type="text"]:focus {
    outline: none;
    border-color: #42b983;
    box-shadow: 0 0 0 3px rgba(66, 185, 131, 0.2);
}

/* General Purpose Button (used by all pages) */
#generateBtn, #analyzeBtn, #calculateBtn {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    font-weight: 700;
    color: white;
    background: linear-gradient(45deg, #42b983, #2a9d8f);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
#generateBtn:disabled, #analyzeBtn:disabled, #calculateBtn:disabled {
    background: #ccc;
    cursor: not-allowed;
}
#generateBtn:hover:not(:disabled), #analyzeBtn:hover:not(:disabled), #calculateBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

/* Result Section */
.result-section {
    margin-top: 30px;
}
.result-section h2 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 20px;
}

/* Loader */
#loader {
    text-align: center;
    padding: 40px 0;
}
.loader-inner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #42b983;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- AI Text Generator Specific --- */
#result-cards-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.result-card {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-left: 5px solid #42b983;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.card-header h3 {
    margin: 0;
    color: #2a9d8f;
}
.copy-btn {
    padding: 6px 12px;
    border: 1px solid #42b983;
    background-color: transparent;
    color: #42b983;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}
.copy-btn:hover {
    background-color: #42b983;
    color: white;
}
.card-text {
    color: #333;
}

/* --- History Section --- */
.history-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}
.history-section h2 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 15px;
}
#history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.history-item {
    background: #f9f9f9;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.3s, box-shadow 0.3s;
    border: 1px solid #eee;
}
.history-item:hover {
    background-color: #f0f0f0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}


/* --- AI Decision Helper Specific --- */
.disclaimer {
    background-color: #fffbe6;
    border: 1px solid #ffe58f;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 25px;
}
.disclaimer p {
    margin: 0;
    color: #8a6d3b;
}

.recommendation-summary {
    background-color: #e8f5e9;
    border-left: 5px solid #4caf50;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}
.recommendation-summary h3 {
    margin-top: 0;
}
.recommendation-summary .highlight {
    color: #2e7d32;
    font-weight: 700;
}

.score-board, .comparison-table, .reasoning-section {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}

.score-board h4, .comparison-table h4, .reasoning-section h4 {
    margin-top: 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.score-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}
.score-item label {
    width: 180px;
    font-weight: 600;
}
.progress-bar-container {
    flex-grow: 1;
    height: 24px;
    background-color: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background-color: #42b983;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: bold;
    transition: width 0.5s ease-in-out;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
}
.comparison-table th, .comparison-table td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #ddd;
}
.comparison-table th {
    background-color: #f2f2f2;
}
.comparison-table td:nth-child(1) { width: 25%; }

/* --- Language Switcher --- */
.language-switcher {
    position: relative;
    display: inline-block;
}

.selected-lang {
    cursor: pointer;
    padding: 10px 15px;
    background-color: #34495e;
    color: white;
    border-radius: 6px;
    font-weight: 600;
    transition: background-color 0.3s;
}

.selected-lang:hover {
    background-color: #4a637e;
}

.lang-dropdown {
    display: none;
    position: absolute;
    right: 0;
    background-color: #f9f9f9;
    min-width: 100px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 100;
    list-style: none;
    padding: 0;
    margin: 5px 0 0 0;
    border-radius: 6px;
    overflow: hidden;
}

.lang-dropdown li a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
    font-weight: normal;
    border-radius: 0;
}

.lang-dropdown li a:hover {
    background-color: #f1f1f1;
    color: #2c3e50;
}


/* --- Responsive Design --- */
@media (max-width: 768px) {
    #result-cards-container, .form-grid {
        grid-template-columns: 1fr;
    }
    .comparison-table table, .comparison-table thead, .comparison-table tbody, .comparison-table th, .comparison-table td, .comparison-table tr {
        display: block;
    }
    .comparison-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    .comparison-table tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
    }
    .comparison-table td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
    }
    .comparison-table td:before {
        position: absolute;
        top: 6px;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: bold;
    }
    .comparison-table td:nth-of-type(1):before { content: "Criteria"; }
    .comparison-table td:nth-of-type(2):before { content: "Option A"; }
    .comparison-table td:nth-of-type(3):before { content: "Option B"; }
    
    .score-item {
        flex-direction: column;
        align-items: flex-start;
    }
    .score-item label { width: auto; margin-bottom: 5px; }
    .progress-bar-container { width: 100%; }

    .nav-bar .menu {
        flex-direction: column;
        align-items: stretch;
        padding: 0 10px;
    }
    .nav-links {
        flex-direction: column;
        width: 100%;
        align-items: center;
    }
    .nav-links li {
        width: 100%;
        margin-bottom: 5px;
    }
    .nav-links li a {
        display: block;
        text-align: center;
    }
    .language-switcher {
        margin-top: 10px;
        width: 100%;
    }
    .selected-lang {
        text-align: center;
    }
    .lang-dropdown {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }
}
