/* General Body & Layout */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background: var(--background-image);
    background-attachment: fixed;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: 16px;
    line-height: 1.6;
}

main {
    flex-grow: 1;
    padding: 2rem 1rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--header-color);
}

header p {
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    margin: 0;
    opacity: 0.8;
}

/* How It Works Section */
.how-it-works {
    max-width: 800px;
    margin: 1rem auto 0 auto;
    padding: 1rem 1.5rem;
    background: rgba(0,0,0,0.1);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
    line-height: 1.6;
    text-align: left;
}

.how-it-works p {
    margin: 0 0 0.75rem 0;
}

.how-it-works ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.25rem 1.5rem;
    padding-left: 1.25rem;
    margin: 0;
}

#aiFeatureDescription {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Mobile Tabs */
.mobile-tabs {
    display: none; /* Hidden on desktop */
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.mobile-tab-button {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-color);
    opacity: 0.6;
    font-size: 1rem;
    font-weight: 500;
}

.mobile-tab-button.active {
    opacity: 1;
    border-bottom: 2px solid var(--accent-color);
}

/* Main Container */
.container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--box-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

@media (min-width: 992px) {
    .container {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 991px) {
    .container {
        display: block; /* Change from grid to block on mobile */
        padding-top: 1rem;
    }
    .mobile-tabs {
        display: flex; /* Show tabs on mobile */
    }
    .mobile-tab-panel {
        display: none; /* Hide all panels by default on mobile */
    }
    .mobile-tab-panel.active {
        display: flex; /* Show only the active panel */
    }
    .box-section {
        /* Remove the extra space between sections when they are stacked */
        margin-bottom: 0;
    }
}

/* Text Area Sections */
.box-section {
    display: flex;
    flex-direction: column;
    position: relative;
}

.box-section h2 {
    font-size: 1.25rem;
    font-weight: 500;
    margin: 0 0 1rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0.9;
}

textarea {
    width: 100%;
    flex-grow: 1;
    min-height: 400px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--output-bg);
    color: var(--text-color);
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 0.95rem;
    resize: none;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(var(--accent-color-rgb, 74, 144, 226), 0.5);
}

#outputText {
    cursor: pointer;
}

/* Buttons and Notifications */
.copy-button {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.copy-button:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #000;
}

.copy-button:disabled {
    background-color: #28a745; /* Success Green */
    border-color: #28a745;
    color: white;
    cursor: default;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping on mobile */
    margin-bottom: 1rem;
    gap: 0.75rem;
}

.output-header h2 {
    margin: 0; /* Remove default margins from h2 inside the new header */
}

.ai-actions {
    display: flex;
    gap: 0.5rem;
}

/* Custom styling for the API provider dropdown */
.ai-actions select, #apiProviderSelect {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23e0e0e0%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right .7em top 50%;
    background-size: .65em auto;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.ai-actions select:hover, #apiProviderSelect:hover {
    background-color: var(--button-hover-bg, #3a3a3a);
}

/* Text Stats Counters -- new styles */
.text-stats-container {
    display: none; /* Hidden by default */
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 0.75rem;
}

.text-stats-container.visible {
    display: grid;
}

.stat-item {
    background-color: var(--output-bg);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Menlo', 'Consolas', monospace;
}

.stat-label {
    font-size: 0.8rem;
    opacity: 0.7;
}

.stat-value {
    font-size: 0.9rem;
    font-weight: 600;
}
 
/* Summary Section */
.summary-footer {
    max-width: 1400px;
    margin: 2rem auto 0 auto;
    padding: 1.5rem;
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none; /* Hidden by default */
}

.summary-footer h3 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    font-weight: 500;
}

#summaryList {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.75rem;
}

#summaryList li {
    background-color: var(--output-bg);
    padding: 0.5rem 1rem;
    border-radius: 6px;
}

/* Page Footer */
.page-footer {
    text-align: center;
    padding: 2rem 1rem;
    opacity: 0.7;
}

.page-footer p {
    margin: 0 0 0.5rem 0;
}

.page-footer nav a {
    color: var(--text-color);
    text-decoration: none;
    margin: 0 0.75rem;
    transition: color 0.2s ease;
}

.page-footer nav a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* Cookie Consent Banner */
.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    color: white;
    padding: 1rem;
    display: none;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    z-index: 1000;
    flex-wrap: wrap;
}

.cookie-message {
    margin: 0;
    text-align: center;
}

.cookie-buttons {
    display: flex;
    gap: 1rem;
}

.cookie-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.accept-btn {
    background-color: var(--accent-color);
    color: #000;
}

.decline-btn {
    background-color: #4f4f4f;
    color: white;
}
