:root {
    --primary-color: #0056b3;
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --text-color: #333333;
    --border-color: #dddddd;
    --hover-bg: #e2e6ea;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

header {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab-btn {
    flex: 1;
    min-width: 120px;
    padding: 0.75rem 1rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-weight: bold;
    color: var(--text-color);
    transition: background-color 0.2s;
}

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

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

.input-section, .output-section, .history-section {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0 4px 4px 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.calc-form {
    display: none;
}

.calc-form.active {
    display: block;
}

.calc-form h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.input-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.input-group label {
    flex: 1;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    font-weight: bold;
    font-size: 0.9rem;
}

.input-group input {
    padding: 0.5rem;
    margin-top: 0.25rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

button[type="submit"], #clear-history {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: opacity 0.2s;
}

button[type="submit"]:hover, #clear-history:hover {
    opacity: 0.9;
}

small {
    display: block;
    margin-bottom: 1rem;
    color: #666;
}

.hidden {
    display: none;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.result-card {
    background-color: var(--bg-color);
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.result-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #555;
}

.result-card p {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-color);
}

.optical-cross-visual {
    text-align: center;
    margin-top: 2rem;
}

.optical-cross-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4rem;
    margin-top: 2rem;
}

@media (max-width: 700px) {
    .optical-cross-container {
        flex-direction: column;
        gap: 3rem;
    }
}

.cross-text-summary {
    font-size: 1.5rem;
    font-weight: normal;
    text-align: center;
    background: #5dc3f6; /* Light blue background */
    color: #000;
    padding: 1.5rem 2.5rem;
    border-radius: 12px;
    min-width: 200px;
    line-height: 1.4;
}

.cross-diagram {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 2rem;
}

.cross-diagram .line {
    position: absolute;
    background-color: #000; /* Black lines */
    display: flex;
    align-items: center;
    justify-content: center;
}

.cross-diagram .vertical {
    width: 3px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
}

.cross-diagram .horizontal {
    width: 100%;
    height: 3px;
    top: 50%;
    transform: translateY(-50%);
}

.cross-diagram .power, .cross-diagram .axis {
    position: absolute;
    font-size: 1rem;
    background: transparent;
    border: none;
    color: #000;
    white-space: nowrap;
}

/* North: Vertical Meridian */
.cross-diagram .vertical .axis {
    top: -30px;
    color: #1e70ff; /* Blue text */
}

/* South: Vertical Power */
.cross-diagram .vertical .power {
    bottom: -30px;
}

/* West: Horizontal Meridian */
.cross-diagram .horizontal .axis {
    left: -60px;
    color: #1e70ff; /* Blue text */
}

/* East: Horizontal Power */
.cross-diagram .horizontal .power {
    right: -60px;
}

/* Guide Table */
.guide-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 1rem;
}

.guide-table th, .guide-table td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.guide-table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}

.guide-table tr:nth-child(even) {
    background-color: var(--hover-bg);
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 2rem;
    color: #666;
    font-size: 0.9rem;
}

.app-footer p {
    margin: 0;
}

.app-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}

.app-footer a:hover {
    text-decoration: underline;
}
