/* General Styles & Fonts */
:root {
    --primary-color: #007bff;
    --secondary-color: #f3f4f6;
    --text-color: #111827;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --success-color: #48bb78;
    --warning-color: #f6ad55;
    --danger-color: #f56565;
    --neutral-color: #a0aec0;
    
    --bg-light: #f3f4f6;
    --bg-dark: #1f2937;
    --card-light: #ffffff;
    --card-dark: #374151;
    --text-light: #111827;
    --text-dark: #f9fafb;
    --border-light: #e5e7eb;
    --border-dark: #4b5563;
}

html.dark {
    --secondary-color: var(--bg-dark);
    --card-bg: var(--card-dark);
    --text-color: var(--text-dark);
    --border-color: var(--border-dark);
}

body {
    background-color: var(--secondary-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

/* Main Content & Sections */
.main-content {
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.tool-section {
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 2rem;
    margin-bottom: 2rem;
}

.tool-section h2 {
    margin-top: 0;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    display: inline-block;
}

/* Buttons & Confirmations */
.btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn:hover {
    background-color: #0056b3;
}

.btn:disabled {
    background-color: #a0aec0;
    cursor: not-allowed;
}

.confirmation-message {
    margin-top: 1rem;
    color: var(--success-color);
    font-weight: 500;
    display: none; /* Hidden by default */
}

/* Device Info Table */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.info-table th, .info-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.info-table th {
    width: 35%;
    font-weight: 600;
}

.info-table td {
    word-break: break-all; /* Ensures long text doesn't break layout */
}

.info-table tr:last-child th, .info-table tr:last-child td {
    border-bottom: none;
}

/* Speed Test Embed */
.speedtest-container {
    width: 100%;
    height: 450px; /* Adjust height as needed */
    border: none;
}

/* --- STYLES FOR CARD-BASED MENU --- */
.app-view {
    display: none;
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.menu-header {
    text-align: center;
    margin-bottom: 2rem;
}

.menu-header h1 {
    margin-bottom: 0.5rem;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.app-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.app-card .app-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.app-card h3 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.app-card p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #6c757d;
}

.back-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    display: inline-block;
    transition: background-color 0.2s, color 0.2s;
}

.back-btn:hover {
    background-color: #e5e7eb;
}
html.dark .back-btn:hover {
     background-color: #4b5563;
}

/* --- STYLES FOR INPUT-BASED TOOLS --- */
.tool-form {
    display: flex;
    flex-wrap: wrap; 
    gap: 10px;
    margin-top: 1rem;
}

.tool-input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
}

.results-box {
    background-color: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 1rem;
    margin-top: 1rem;
    min-height: 100px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: monospace;
}

/* --- STYLES FOR WI-FI SCANNER --- */
#scanner-results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.scanner-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.scanner-card-full {
    grid-column: 1 / -1;
}

.scanner-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.scanner-card-header .scanner-icon {
    font-size: 1.5rem;
}

.scanner-card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-color);
}

.scanner-card-content {
    margin: 0;
    color: #667;
    line-height: 1.5;
}

.scanner-card-content strong {
    color: var(--text-color);
}

#summary-card {
    margin-top: 1.5rem;
}

#summary-content {
    text-align: center;
}

#risk-level {
    margin: 0;
    font-size: 2rem;
    font-weight: bold;
    transition: color 0.3s;
}

#risk-advice {
    margin-top: 0.5rem;
    font-size: 1rem;
    color: #667;
}

/* Status Colors */
.status-good { color: var(--success-color); }
.status-bad { color: var(--danger-color); }
.status-warn { color: var(--warning-color); }

/* --- STYLES FOR SCREEN SHARING --- */
.screenshare-container {
    display: flex;
    gap: 2rem;
}
.screenshare-panel {
    flex: 1;
}
.screenshare-panel h3, .screenshare-panel h4 {
    margin-top: 0;
}
.screenshare-textarea {
    width: 100%;
    min-height: 120px;
    font-family: monospace;
    font-size: 0.9rem;
    padding: 0.5rem;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    box-sizing: border-box;
}
#remote-video {
    width: 100%;
    max-width: 100%;
    border-radius: 8px;
    background-color: #000;
    border: 1px solid var(--border-color);
}
.qr-code-container {
    margin-top: 1rem;
    text-align: center;
}
#offer-qr-code, #answer-qr-code {
    max-width: 150px;
    margin: 0 auto;
}
.file-status {
    font-size: 0.9rem;
    color: var(--subtext-color);
    margin-top: 0.5rem;
    min-height: 1.2em;
}
.step-label {
    font-weight: bold;
    margin-bottom: 0.5rem;
}
.copy-notification {
    color: var(--success-color);
    font-weight: bold;
    font-size: 0.9rem;
    height: 1em;
}

/* --- STYLES FOR IMAGE REDUCER --- */
.reducer-preview-container {
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    text-align: center;
}
.reducer-preview-container img {
    max-width: 100%;
    max-height: 300px;
    height: auto;
    margin: 0 auto 0.5rem;
    border-radius: 4px;
}
.reducer-preview-container p {
    font-weight: 500;
}

/* --- STYLES FOR WORD COUNTER --- */
.counter-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.counter-stats div {
    font-size: 1.1rem;
}
.counter-stats span:first-child {
    font-weight: bold;
}

/* --- STYLES FOR PASSWORD GENERATOR --- */
.password-display-container {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}
#password-output {
    flex-grow: 1;
    padding: 0.5rem 1rem;
    font-family: monospace;
    font-size: 1.2rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--secondary-color);
}
.password-options {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.password-options .option {
    display: flex;
    flex-direction: column;
}
.password-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.strength-meter {
    margin-top: 1rem;
    width: 100%;
    height: 24px;
    background-color: #e5e7eb;
    border-radius: 5px;
    position: relative;
    overflow: hidden;
}
.strength-bar {
    height: 100%;
    width: 0;
    border-radius: 5px;
    transition: width 0.3s, background-color 0.3s;
}
#strength-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-weight: bold;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
}

/* --- STYLES FOR FILE CONVERTER --- */
.preview-area {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    border: 2px dashed var(--border-color);
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 0.5rem;
    background-color: var(--secondary-color);
}
#docx-preview p {
    margin-bottom: 1em;
}
#docx-preview h1, #docx-preview h2, #docx-preview h3 {
    font-weight: bold;
    margin-top: 1.2em;
    margin-bottom: 0.5em;
}
#docx-preview h1 { font-size: 2em; }
#docx-preview h2 { font-size: 1.5em; }
#docx-preview h3 { font-size: 1.17em; }

/* --- STYLES FOR MARKDOWN PREVIEWER --- */
.prose {
    line-height: 1.6;
}
.prose h1, .prose h2, .prose h3 {
    font-weight: 600;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}
.prose p {
    margin-bottom: 1em;
}
.prose code {
    background-color: var(--secondary-color);
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    border-radius: 3px;
    font-family: monospace;
}
.prose pre {
    background: var(--secondary-color);
    padding: 1em;
    border-radius: 5px;
    overflow-x: auto;
}
.prose pre code {
    padding: 0;
    background: transparent;
}
.prose blockquote {
    border-left: 0.25em solid var(--border-color);
    padding-left: 1em;
    color: #6a737d;
    margin-left: 0;
}
.prose ul, .prose ol {
    padding-left: 2em;
}


/* Responsive Design */
@media (max-width: 768px) {
    .main-content, .app-view {
        padding: 1rem;
    }
    .tool-section {
        padding: 1.5rem;
    }
    .info-table th {
        width: 45%;
    }
    .tool-form {
        flex-direction: column;
    }
    #scanner-results-grid {
        grid-template-columns: 1fr;
    }
    .screenshare-container {
        flex-direction: column;
    }
    .password-options {
        grid-template-columns: 1fr;
    }
}