@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #3f7773;
    --primary-hover: #2e5855;
    --bg-page: #4b5563; /* Matte Gray */
    --bg-card: rgba(255, 255, 255, 0.85); /* High Opacity White Glass for Black Text */
    --border: rgba(0, 0, 0, 0.1);
    --text-main: #000000; /* Back to Black */
    --text-dim: #444444;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --transition: all 0.2s ease-in-out;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-page);
    color: var(--text-main);
    height: 100vh;
    margin: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Tool Container */
.tool-container {
    width: 100%;
    height: 100vh;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

/* Header */
.tool-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.site-branding {
    display: flex;
    flex-direction: column;
}

.site-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.1;
}

.site-tagline {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-dim);
    margin-top: 2px;
}

/* Toolbar */
.toolbar {
    padding: 16px 32px;
    background: rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
}

.ui-select {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 0.875rem;
    color: #000000;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

.ui-select:hover {
    background: #fff;
    border-color: var(--primary);
}

/* Tone Selector */
.tone-selector {
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.tone-chip {
    padding: 6px 14px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #444444;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.tone-chip:hover {
    background: #fff;
    border-color: var(--text-dim);
    color: black;
}

.tone-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Workspace Quad Grid */
.workspace-quad {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex: 1; /* Take up available space */
    min-height: 0; /* Allow internal scrolling */
}

.panel {
    padding: 32px;
    display: flex;
    flex-direction: column;
    background: transparent;
}

.panel-top-left { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.panel-top-right { border-bottom: 1px solid var(--border); }
.panel-bottom-left { border-right: 1px solid var(--border); }
.panel-bottom-right { border-right: none; }

.panel-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
}

textarea, .output-area {
    flex: 1;
    width: 100%;
    border: none;
    outline: none;
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-main);
    resize: none;
    background: transparent;
    white-space: pre-wrap;
    text-align: left;
    overflow-y: auto; /* Internal scroll only */
}

[dir="rtl"] textarea, [dir="rtl"] .output-area {
    text-align: right;
}

/* Footer Action */
.action-footer {
    padding: 24px 32px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
}

#appStatusText {
    margin-left: 20px;
    font-size: 0.85rem;
    color: #6b7280; /* Neutral Gray */
    font-weight: 500;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: var(--border);
    cursor: not-allowed;
}

/* 3D Background Canvas */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Unified Solid Footer */
/* Unified Solid Footer */
.site-footer {
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    padding: 12px 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.footer-links-group {
    flex: 1;
}

.footer-links-group h3 {
    display: none; /* Hide title to save space */
}

.footer-links {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.footer-links a {
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    color: #000000;
    text-decoration: none;
}

.footer-links a:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Creator Branding inside Solid Footer */
.creator-branding {
    padding-left: 40px;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.creator-name-link {
    text-decoration: none;
}

.creator-name { 
    font-size: 0.8rem;
    font-weight: 800; 
    color: #000000; 
    margin: 0;
}

.creator-tagline { 
    font-size: 0.6rem; 
    font-weight: 600;
    color: var(--primary); 
    margin: 0;
}

.motivational-quote { 
    display: none;
}

/* RTL Adjustments for Unified Footer */
[dir="rtl"] .creator-branding {
    padding-left: 0;
    padding-right: 40px;
    border-left: none;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
}

@media (max-width: 900px) {
    .footer-content { grid-template-columns: 1fr; gap: 40px; }
    .creator-branding { padding-left: 0; border-left: none; border-top: 1px solid rgba(0, 0, 0, 0.1); padding-top: 40px; }
    [dir="rtl"] .creator-branding { padding-right: 0; border-right: none; }
}

/* Language Toggle */
.lang-toggle-container {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
}

.lang-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: 6px;
}

.lang-btn.active {
    background: white;
    color: var(--text-main);
    box-shadow: var(--shadow);
}

/* Utilities */
.font-sans { font-family: 'Inter', sans-serif !important; }
.font-serif { font-family: 'Georgia', serif !important; }
.font-mono { font-family: 'Courier New', monospace !important; }
.size-sm { font-size: 0.9rem !important; }
.size-md { font-size: 1.125rem !important; }
.size-lg { font-size: 1.3rem !important; }

/* RTL */
[dir="rtl"] .panel-top-left, [dir="rtl"] .panel-bottom-left { border-right: none; border-left: 1px solid var(--border); }
[dir="rtl"] .motivational-quote { border-left: none; border-right: 2px solid var(--primary); padding-left: 0; padding-right: 12px; }

@media (max-width: 950px) {
    .workspace-quad { grid-template-columns: 1fr; }
    .panel-top-left, .panel-top-right, .panel-bottom-left { border-right: none; border-bottom: 1px solid var(--border); }
    .site-footer { grid-template-columns: 1fr; }
}

/* API Modal */
.api-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.api-modal-content {
    background: white;
    padding: 32px;
    border-radius: 20px;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.api-modal-content h3 {
    margin-bottom: 12px;
    color: #000;
}

.api-modal-content p {
    font-size: 0.9rem;
    color: #444;
    margin-bottom: 24px;
}

.api-modal-content input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 24px;
    font-size: 1rem;
    outline: none;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}
