/* Theme variables */
:root {
    /* Light theme (default) */
    --bg-color: #f5f5f5;
    --text-color: #333;
    --header-bg: white;
    --sidebar-bg: #2c3e50;
    --sidebar-text: white;
    --sidebar-active-bg: #34495e;
    --sidebar-hover-bg: #34495e;
    --sidebar-border: #3498db;
    --card-bg: white;
    --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --input-border: #ddd;
    --input-focus-border: #3498db;
    --input-focus-shadow: rgba(52, 152, 219, 0.2);
    --button-bg: #3498db;
    --button-hover-bg: #2980b9;
    --button-text: white;
    --toggle-bg: #ccc;
    --toggle-active-bg: #3498db;
    --toggle-handle-bg: #2c3e50;
    --section-bg: #f8f9fa;
    --divider-color: #ddd;
    --footer-bg: #2c3e50;
    --footer-text: white;
    --error-bg: #ffebee;
    --error-border: #c62828;
    --error-text: #c62828;
    --modal-overlay: rgba(0, 0, 0, 0.5);
    --icon-border: #ddd;
    --icon-hover-border: #3498db;
    --icon-selected-bg: #e1f0fa;
    --copy-btn-bg: #f0f0f0;
    --copy-btn-text: #333;
    --copy-btn-border: #ddd;
    --copy-btn-hover-bg: #e0e0e0;
    --copy-success-bg: #4CAF50;
    --copy-success-text: white;
    --tool-item-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --tool-item-hover-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    --tool-item-text: #666;
}

/* Dark theme */
[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --header-bg: #1e1e1e;
    --sidebar-bg: #1e1e1e;
    --sidebar-text: #e0e0e0;
    --sidebar-active-bg: #2c2c2c;
    --sidebar-hover-bg: #2c2c2c;
    --sidebar-border: #3498db;
    --card-bg: #1e1e1e;
    --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    --input-border: #444;
    --input-focus-border: #3498db;
    --input-focus-shadow: rgba(52, 152, 219, 0.3);
    --button-bg: #3498db;
    --button-hover-bg: #2980b9;
    --button-text: white;
    --toggle-bg: #444;
    --toggle-active-bg: #3498db;
    --toggle-handle-bg: #121212;
    --section-bg: #2c2c2c;
    --divider-color: #444;
    --footer-bg: #1e1e1e;
    --footer-text: #e0e0e0;
    --error-bg: #3a0505;
    --error-border: #c62828;
    --error-text: #ff5252;
    --modal-overlay: rgba(0, 0, 0, 0.7);
    --icon-border: #444;
    --icon-hover-border: #3498db;
    --icon-selected-bg: #2c3e50;
    --copy-btn-bg: #333;
    --copy-btn-text: #e0e0e0;
    --copy-btn-border: #444;
    --copy-btn-hover-bg: #444;
    --copy-success-bg: #4CAF50;
    --copy-success-text: white;
    --tool-item-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --tool-item-hover-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --tool-item-text: #aaa;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    padding: 0;
    margin: 0;
    height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

/* Layout styles */
.page-container {
    display: flex;
    min-height: 100vh;
}

.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Sidebar styles */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, background-color 0.3s;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar h1 {
    font-size: 1.5rem;
    margin: 0;
}

.sidebar nav {
    padding: 1rem 0;
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    margin-bottom: 0.5rem;
}

.sidebar .nav-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 0.75rem 1.5rem;
}

.sidebar a {
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    display: block;
    transition: background-color 0.3s;
    border-left: 3px solid transparent;
}

.sidebar a:hover {
    background-color: var(--sidebar-hover-bg);
}

.sidebar a.active {
    background-color: var(--sidebar-active-bg);
    border-left-color: var(--sidebar-border);
}

/* Header styles */
header {
    background-color: var(--header-bg);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.3s;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
}

.mobile-menu-toggle span {
    height: 3px;
    width: 100%;
    background-color: var(--text-color);
    border-radius: 3px;
    transition: background-color 0.3s;
}

/* Theme toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    margin-left: auto;
    margin-right: 1rem;
}

.theme-toggle-label {
    margin-right: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-color);
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--toggle-bg);
    transition: .4s;
    border-radius: 24px;
}

.theme-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.theme-switch input:checked + .theme-slider {
    background-color: var(--toggle-active-bg);
}

.theme-switch input:checked + .theme-slider:before {
    transform: translateX(26px);
}

.theme-icon {
    position: absolute;
    top: 4px;
    font-size: 14px;
    transition: opacity 0.3s;
}

.sun-icon {
    left: 6px;
    opacity: 1;
    color: #f39c12;
}

.moon-icon {
    right: 6px;
    opacity: 0;
    color: #f5f5f5;
}

.theme-switch input:checked + .theme-slider .sun-icon {
    opacity: 0;
}

.theme-switch input:checked + .theme-slider .moon-icon {
    opacity: 1;
}

/* Main content styles */
main {
    flex: 1;
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
    width: 100%;
}

.tool-section {
    display: none;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.tool-section.active {
    display: block;
}

.tool-section h2 {
    margin-bottom: 1.5rem;
    color: var(--text-color);
    text-align: center;
}

.tool-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Form elements */
.input-group, .output-group, .toggle-group, .radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-weight: 600;
    color: var(--text-color);
}

input, textarea {
    padding: 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    font-size: 1rem;
    width: 100%;
    background-color: var(--card-bg);
    color: var(--text-color);
    transition: border-color 0.3s, box-shadow 0.3s, background-color 0.3s, color 0.3s;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 2px var(--input-focus-shadow);
}

input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

button {
    background-color: var(--button-bg);
    color: var(--button-text);
    border: none;
    border-radius: 4px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: var(--button-hover-bg);
}

button:active {
    transform: translateY(1px);
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 200px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch label {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--toggle-bg);
    border-radius: 34px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    transition: background-color 0.3s;
}

.toggle-switch label:before {
    content: "";
    position: absolute;
    height: 26px;
    width: 90px;
    left: 4px;
    bottom: 4px;
    background-color: var(--toggle-handle-bg);
    border-radius: 34px;
    transition: 0.4s;
    z-index: 1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + label:before {
    transform: translateX(100px);
}

.toggle-switch input:checked + label {
    background-color: var(--toggle-active-bg);
}

.toggle-option {
    color: var(--text-color);
    z-index: 2;
    position: relative;
    font-weight: normal;
    padding: 0 5px;
    text-align: center;
    width: 90px;
}

/* Style for the active option */
.toggle-switch input:not(:checked) + label .toggle-option:first-child,
.toggle-switch input:checked + label .toggle-option:last-child {
    color: white;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Style for the inactive option */
.toggle-switch input:checked + label .toggle-option:first-child,
.toggle-switch input:not(:checked) + label .toggle-option:last-child {
    color: var(--text-color);
    font-weight: normal;
}

/* Radio buttons */
.radio-options {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.radio-options input[type="radio"] {
    width: auto;
    margin-right: 0.25rem;
}

.radio-options label {
    font-weight: normal;
}

/* Timestamp output */
.timestamp-result {
    padding: 1rem;
    background-color: var(--section-bg);
    border: 1px solid var(--divider-color);
    border-radius: 4px;
    min-height: 60px;
    color: var(--text-color);
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

/* Invisible character viewer */
.invisible-char-result {
    padding: 1rem;
    background-color: var(--section-bg);
    border: 1px solid var(--divider-color);
    border-radius: 4px;
    min-height: 60px;
    overflow-x: auto;
    color: var(--text-color);
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

/* Image Base64 Converter */
.image-preview-container {
    padding: 1rem;
    background-color: var(--section-bg);
    border: 1px solid var(--divider-color);
    border-radius: 4px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    transition: background-color 0.3s, border-color 0.3s;
}

.preview-image {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
}

.error-message {
    background-color: var(--error-bg);
    color: var(--error-text);
    padding: 0.75rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    border-left: 4px solid var(--error-border);
    transition: background-color 0.3s, color 0.3s;
}

/* Footer */
footer {
    text-align: center;
    padding: 1rem;
    background-color: var(--footer-bg);
    color: var(--footer-text);
    margin-top: auto;
    transition: background-color 0.3s, color 0.3s;
}

/* UTF-8 Icons Tool */
.search-filter-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-filter-container > div {
    flex: 1;
    min-width: 200px;
}

.search-filter-container .button-group {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.search-filter-container .button-group button {
    margin-top: auto; /* Push the button to the bottom to align with inputs */
}

.select-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

select {
    padding: 0.75rem;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    font-size: 1rem;
    background-color: var(--card-bg);
    color: var(--text-color);
    transition: border-color 0.3s, background-color 0.3s, color 0.3s;
}

select:focus {
    outline: none;
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 2px var(--input-focus-shadow);
}

.categories-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.category-section {
    margin-bottom: 1rem;
}

.category-header {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--divider-color);
    transition: color 0.3s, border-color 0.3s;
}

.icons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 1rem;
    padding: 0.5rem;
    background-color: var(--section-bg);
    border-radius: 4px;
    transition: background-color 0.3s;
}

.icon-item {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    font-size: 2rem;
    background-color: var(--card-bg);
    border: 1px solid var(--icon-border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s, background-color 0.3s, border-color 0.3s;
}

.icon-item:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: var(--icon-hover-border);
}

.icon-item.selected {
    background-color: var(--icon-selected-bg);
    border-color: var(--icon-hover-border);
    box-shadow: 0 0 0 2px var(--input-focus-shadow);
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay);
    overflow: auto;
    transition: background-color 0.3s;
}

.modal-content {
    position: relative;
    background-color: var(--card-bg);
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    width: 80%;
    max-width: 500px;
    animation: modalFadeIn 0.3s;
    transition: background-color 0.3s;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--text-color);
}

.modal-body {
    padding: 10px 0;
}

.selected-icon-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.selected-icon {
    font-size: 3rem;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--card-bg);
    border: 1px solid var(--icon-border);
    border-radius: 4px;
    transition: background-color 0.3s, border-color 0.3s;
}

.icon-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: space-between;
}

.info-label {
    font-weight: 600;
    min-width: 80px;
    color: var(--text-color);
    transition: color 0.3s;
}

.info-row span:nth-child(2) {
    flex-grow: 1;
    word-break: break-all;
    color: var(--text-color);
    transition: color 0.3s;
}

.copy-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    background-color: var(--copy-btn-bg);
    color: var(--copy-btn-text);
    border: 1px solid var(--copy-btn-border);
    margin-left: auto;
    min-width: 70px;
    text-align: center;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

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

.copy-success {
    background-color: var(--copy-success-bg);
    color: var(--copy-success-text);
}

/* Tools Overview */
.tools-compact-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

.tool-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--tool-item-shadow);
    padding: 12px 16px;
    transition: box-shadow 0.2s, background-color 0.3s;
}

.tool-list-item:hover {
    box-shadow: var(--tool-item-hover-shadow);
}

.tool-info {
    flex: 1;
}

.tool-list-item h3 {
    margin: 0 0 5px 0;
    color: var(--text-color);
    font-size: 1.1rem;
    transition: color 0.3s;
}

.tool-list-item p {
    margin: 0;
    color: var(--tool-item-text);
    font-size: 0.9rem;
    transition: color 0.3s;
}

.tool-link-btn {
    display: inline-block;
    background-color: var(--button-bg);
    color: var(--button-text);
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s;
    cursor: pointer;
    min-width: 70px;
    text-align: center;
    margin-left: 15px;
}

.tool-link-btn:hover {
    background-color: var(--button-hover-bg);
}

/* Color Converter Tool */
.color-preview {
    width: 100%;
    height: 100px;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--divider-color);
    transition: background-color 0.3s;
}

.color-formats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.color-format {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-format-label {
    min-width: 50px;
    font-weight: 600;
}

.rgb-inputs {
    display: flex;
    gap: 0.5rem;
}

.rgb-inputs input, .hsl-inputs input {
    width: 70px;
    text-align: center;
}

.hsl-inputs {
    display: flex;
    gap: 0.5rem;
}

.color-variations {
    margin-top: 1.5rem;
}

.color-variations h3 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.shades-container, .tints-container {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
}

.swatch-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    transition: transform 0.2s;
    flex: 1;
    margin: 0 2px;
}

.swatch-container:hover {
    transform: scale(1.05);
}

.color-swatch {
    width: 100%;
    height: 50px;
    border-radius: 4px;
    border: 1px solid var(--divider-color);
}

.color-value {
    font-size: 0.75rem;
    color: var(--text-color);
    text-align: center;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.copy-success-message {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--copy-success-bg);
    color: var(--copy-success-text);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9rem;
    z-index: 1000;
    animation: fadeIn 0.3s;
}

.copy-success-message.fade-out {
    animation: fadeOut 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translate(-50%, 0); }
    to { opacity: 0; transform: translate(-50%, 10px); }
}

/* About page styles */
.about-content {
    max-width: 100%;
    line-height: 1.6;
}

.about-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-color);
    border-bottom: 1px solid var(--divider-color);
    padding-bottom: 0.5rem;
    transition: color 0.3s, border-color 0.3s;
}

.about-content p {
    margin-bottom: 1rem;
    color: var(--text-color);
    transition: color 0.3s;
}

.about-tools-list {
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.about-tools-list li {
    margin-bottom: 0.5rem;
    color: var(--text-color);
    transition: color 0.3s;
}

.about-content a {
    color: var(--button-bg);
    text-decoration: none;
    transition: color 0.2s;
}

.about-content a:hover {
    color: var(--button-hover-bg);
    text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .page-container {
        position: relative;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        transform: translateX(-100%);
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .content-wrapper {
        margin-left: 0;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .tool-section {
        padding: 1.5rem;
    }
    
    .icons-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }
    
    .selected-icon-container {
        flex-direction: column;
        text-align: center;
    }
    
    .theme-toggle {
        margin-right: 0.5rem;
    }
    
    .theme-toggle-label {
        display: none;
    }
}
