/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap');

/* Base styles */
html {
    /* Apply background to html to ensure it covers the full page */
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    background-attachment: fixed;
    /* Keep the background static */
}

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    margin: 0;
    /* Add padding to the top to prevent content from being hidden by the fixed header */
    padding-top: 70px;
    /* Adjust this value to match your header's height */
}

/* Header Styles */
.site-header {
    position: fixed;
    /* Fix the header to the top */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 30px;
    background-color: #2c3e50;
    /* Solid background color */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    /* Important for width: 100% */
}

.site-logo {
    font-size: 1.5em;
    font-weight: 600;
    color: #ecf0f1;
    user-select: none;
    /* テキスト選択を無効にする */
    cursor: default;
    /* カーソルがテキスト選択モードにならないようにする */
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 25px;
    margin: 0;
    padding: 0;
}

.main-nav a {
    text-decoration: none;
    color: #bdc3c7;
    font-weight: 400;
    font-size: 1em;
    transition: color 0.3s ease;
}

.main-nav a:hover {
    color: #ffffff;
}

/* Main content area */
.scroll-container {
    /* This class is now just a semantic wrapper */
    padding: 20px;
}

/* Main Container within the scrollable area */
.container {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    margin: 0 auto 20px auto;
    /* Center it horizontally */
    max-width: 1400px;
}

h1,
h2,
h3 {
    color: #1a2533;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
    margin-top: 20px;
}

h1 {
    text-align: center;
}

/* Input section styles */
.input-container {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    border: 3px solid #3498db;
}

.input-container h3 {
    color: #ecf0f1;
    border-bottom-color: #4e6a85;
}

.char-mapping {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.char-mapping label {
    font-weight: bold;
}

.char-mapping input[type="text"] {
    width: 40px;
    height: 40px;
    font-size: 20px;
    text-align: center;
    border-radius: 5px;
    border: 1px solid #7f8c8d;
    background: #34495e;
    color: #ecf0f1;
}

.char-mapping button {
    padding: 8px 12px;
    font-size: 14px;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

#detectCharsButton {
    background: #2980b9;
}

#detectCharsButton:hover {
    background: #3498db;
}

#swapCharsButton {
    background: #27ae60;
}

#swapCharsButton:hover {
    background: #2ecc71;
}

#cipherInput {
    width: 100%;
    min-height: 150px;
    background: #34495e;
    color: #ecf0f1;
    border: 1px solid #7f8c8d;
    border-radius: 5px;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    line-height: 1.8;
    box-sizing: border-box;
}

#analyzeButton {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    background: #e74c3c;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

#analyzeButton:hover {
    background: #c0392b;
}

#errorMessage {
    color: #f1c40f;
    font-weight: bold;
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    min-height: 20px;
    text-align: center;
}

/* Results sections styles */
.method-header {
    background: #17a2b8;
    color: white;
    padding: 10px 15px;
    border-radius: 8px 8px 0 0;
    margin: 20px 0 0 0;
    font-weight: bold;
}

.method-content {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 0 0 8px 8px;
    border: 2px solid #17a2b8;
    border-top: none;
}

.morse-conversion {
    font-family: 'Courier New', monospace;
    background: #f0f0f0;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    word-break: break-all;
}

.conversion-result {
    background: #e8f5e8;
    padding: 15px;
    border-radius: 10px;
    border-left: 5px solid #28a745;
    margin: 15px 0;
    overflow-wrap: break-word;
}

span.highlight {
    /* Make span selector more specific */
    background: #ffeb3b;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    color: #333;
}

/* Final evaluation styles */
.final-summary {
    font-size: 1em;
    color: #155724;
    background: #d4edda;
    padding: 20px;
    border-radius: 10px;
    border: 3px solid #28a745;
    text-align: center;
    margin: 20px 0;
    overflow-wrap: break-word;
}

.final-summary-title {
    font-size: 1.2em;
    font-weight: bold;
}

.final-summary-text {
    font-size: 1.4em;
    margin-top: 10px;
    font-weight: bold;
}

.analysis-note {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #2196f3;
    margin: 15px 0;
    text-align: left;
    color: #333;
    /* Override parent color */
    font-weight: normal;
    /* Override parent weight */
}

.corrected-text {
    font-weight: bold;
    color: #0056b3;
    font-size: 1.2em;
}

/* Morse tables styles */
.morse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.morse-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    border-left: 5px solid #16a085;
    overflow-x: auto;
}

.morse-table {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 8px;
    margin: 15px 0;
    font-size: 12px;
}

.morse-item {
    background: #fff;
    padding: 8px;
    border-radius: 5px;
    text-align: center;
    border: 1px solid #ddd;
}

/* Feature specific styles */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #3498db;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    color: #bdc3c7;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #3498db;
    border-bottom: 3px solid #3498db;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.play-btn {
    background: #f39c12;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 10px;
    font-size: 14px;
}

.play-btn:hover {
    background: #e67e22;
}

.hidden {
    display: none !important;
    /* Force hide */
}

.encode-result-box {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 15px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    margin-top: 10px;
    border: 1px solid #34495e;
    word-break: break-all;
}