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

:root {
    --bg-color: #f5f5f9;
    --sidebar-bg: #ffffff;
    --navbar-bg: rgba(255, 255, 255, 0.95);
    --text-main: #697a8d;
    --text-heading: #566a7f;
    --primary: #696cff;
    --primary-hover: #5f61e6;
    --primary-light: rgba(105, 108, 255, 0.16);
    --border-color: #d9dee3;
    --shadow-sm: 0 2px 6px 0 rgba(67, 89, 113, 0.12);
    --danger: #ff3e1d;
    --muted: #a1acb8;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body {
    font-family: 'Public Sans', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    font-size: 0.9375rem;
    line-height: 1.53;
}

h1, h2, h3, h4, h5, h6 { 
    color: var(--text-heading); 
    font-weight: 500; 
    margin-bottom: 1rem; 
}

a { 
    text-decoration: none; 
    color: var(--primary); 
}

/* ==========================================
   Layout Structure
   ========================================== */
#menu-toggle { display: none; } /* Hidden checkbox for CSS-only interaction state */

.layout-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ==========================================
   Sidebar Navigation
   ========================================== */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    flex-shrink: 0;
    transition: transform 0.3s ease-in-out;
    box-shadow: 0 0.125rem 0.25rem 0 rgba(161, 172, 184, 0.15);
    z-index: 1030;
}

.app-brand {
    padding: 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-heading);
    display: flex;
    align-items: center;
}

.app-brand span { 
    color: var(--primary); 
    margin-right: 0.5rem; 
}

.menu-inner { 
    list-style: none; 
    padding: 0; 
    margin: 0; 
}

.menu-inner li { 
    padding: 0.25rem 1rem; 
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem;
    color: var(--text-main);
    border-radius: 0.375rem;
    transition: all 0.2s ease-in-out;
}

.menu-link:hover { 
    background-color: rgba(67, 89, 113, 0.04); 
}

.menu-item.active .menu-link {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

/* ==========================================
   Main Content Area & Navbar
   ========================================== */
.layout-page {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.navbar {
    height: 62px;
    background: var(--navbar-bg);
    backdrop-filter: blur(6px);
    margin: 1rem 1.5rem 0;
    border-radius: 0.375rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 1020;
}

/* CSS-Only Hamburger Menu (Visible on Mobile) */
.hamburger {
    display: none;
    cursor: pointer;
    font-size: 1.5rem;
    margin-right: 1rem;
    color: var(--text-heading);
}

.content-wrapper { 
    padding: 1.5rem; 
    flex-grow: 1; 
}

/* ==========================================
   Cards & Utility Classes
   ========================================== */
.card {
    background-color: var(--sidebar-bg);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    border: 0;
    margin-bottom: 1.5rem;
}

.card-body { 
    padding: 1.5rem; 
}

.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--muted) !important; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.mt-1 { margin-top: 0.25rem !important; }
.d-block { display: block !important; }

pre, code {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 0.375rem;
    overflow-x: auto;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
}

/* ==========================================
   Form Elements (Text Tools Page)
   ========================================== */
.form-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-heading);
}

.form-control {
    width: 100%;
    padding: 0.4375rem 0.875rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--text-main);
    background-color: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    resize: vertical;
    min-height: 120px;
}

.form-control:focus {
    border-color: var(--primary);
    outline: 0;
    box-shadow: 0 0 0 0.15rem var(--primary-light);
}

.form-control[readonly] {
    background-color: var(--bg-color);
    opacity: 1;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.btn {
    display: inline-block;
    font-weight: 500;
    line-height: 1.53;
    text-align: center;
    cursor: pointer;
    background-color: transparent;
    border: 1px solid transparent;
    padding: 0.4375rem 1.25rem;
    font-size: 0.9375rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease-in-out;
}

.btn-primary {
    color: #fff;
    background-color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0.125rem 0.25rem 0 var(--primary-light);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-secondary {
    color: #fff;
    background-color: #8592a3;
    border-color: #8592a3;
}

.btn-secondary:hover {
    background-color: #788393;
}

/* ==========================================
   CSS-Only Mobile Sidebar Toggle Logic
   ========================================== */
.menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(35, 35, 51, 0.5);
    z-index: 1025;
}

@media (max-width: 1199px) {
    .hamburger { display: block; }
    
    .sidebar {
        position: fixed;
        height: 100vh;
        transform: translateX(-100%);
    }
    
    /* When hidden checkbox is checked, slide sidebar in and show overlay */
    #menu-toggle:checked ~ .layout-wrapper .sidebar {
        transform: translateX(0);
    }
    
    #menu-toggle:checked ~ .layout-wrapper .menu-overlay {
        display: block;
    }
}
