/* styles.css */

/* CSS Variables */
:root {
    --primary-color: #1e40af;
    --secondary-color: #1d4ed8;
    --accent-color: #60a5fa;
    --text-color: #1f2937;
    --light-gray: #f3f4f6;
    --border-radius: 0.375rem;
    --transition-speed: 0.3s;
    --header-height: 4rem;
    --sidebar-width: 250px;
}

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

/* Body Structure */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: var(--header-height);
    font-family: system-ui, -apple-system, sans-serif;
    background-color: #f3f4f6;
    position: relative;
    overflow-x: hidden;
}

/* Page Wrapper */
.page-wrapper {
    display: flex;
    flex: 1;
    position: relative;
    min-height: calc(100vh - var(--header-height));
}

/* Header */
header {
    height: var(--header-height);
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    background-color: white;
    transition: transform 0.3s ease;
    z-index: 40;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    transform: translateX(-100%);
}

.sidebar.active {
    transform: translateX(0);
}

/* Sidebar Navigation */
.sidebar nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar nav li {
    margin: 0;
    padding: 0;
}

.sidebar nav a,
.submenu-toggle {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: background-color 0.2s ease;
    margin: 0;
}

.sidebar nav a:hover,
.submenu-toggle:hover {
    background-color: var(--light-gray);
}

.sidebar nav ul ul {
    padding-left: 1rem;
}

.submenu-toggle {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Content Area */
.content-area {
    flex: 1;
    margin-left: 0;
    padding: 2rem;
    min-height: calc(100vh - var(--header-height));
    width: 100%;
    transition: margin-left 0.3s ease;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 35;
}

.sidebar-overlay.active {
    display: block;
}

/* Footer */
footer {
    position: relative;
    z-index: 45;
    background-color: #1f2937;
    color: white;
    padding: 2rem 0;
    width: 100%;
    margin-top: auto;
}

/* Utility Classes */
.hidden {
    display: none;
}

/* Status Messages */
.success-message,
.error-message {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

.success-message {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #34d399;
}

.error-message {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #f87171;
}

/* Form Styles */
input[type="text"],
input[type="email"],
input[type="number"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: var(--border-radius);
    background-color: white;
    transition: border-color 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

/* Button Styles */
button, 
.button {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
}

.button-primary {
    background-color: var(--primary-color);
    color: white;
}

.button-primary:hover {
    background-color: var(--secondary-color);
}

.button-secondary {
    background-color: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.button-secondary:hover {
    background-color: var(--light-gray);
}

/* Responsive Styles */
@media (min-width: 768px) {
    .sidebar {
        transform: translateX(0);
    }

    .content-area {
        margin-left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .content-area {
        margin-left: 0;
        width: 100%;
    }
}

/* Calculator Page Specific Styles */
.calculator-form {
    max-width: 800px;
    margin: 0 auto;
}

.calculator-form .form-group {
    margin-bottom: 1.5rem;
}

/* Forms Database Page Specific Styles */
.forms-grid {
    display: grid;
    gap: 1.5rem;
}

/* Email Modal Styles */
#emailModal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#emailModal.hidden {
    display: none;
}

.modal-content {
    background-color: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    margin: 1rem;
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: "";
    position: absolute;
    top: calc(50% - 0.5rem);
    left: calc(50% - 0.5rem);
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Print Styles */
@media print {
    .sidebar,
    .sidebar-overlay,
    header {
        display: none;
    }

    .content-area {
        margin-left: 0;
        padding: 0;
    }

    body {
        padding-top: 0;
    }
}

/* Additional CSS to be added to styles.css */
.header {
    height: 4rem; /* 64px */
}

.header .container {
    height: 100%;
}

.header .logo-container {
    height: 100%;
    display: flex;
    align-items: center;
}

.header img {
    max-height: 2.5rem; /* 40px */
    width: auto;
    object-fit: contain;
}

/* Updated sidebar styles */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    background-color: white;
    z-index: 40;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    transform: translateX(0); /* Keep sidebar visible by default on desktop */
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%); /* Hide on mobile by default */
    }

    .sidebar.active {
        transform: translateX(0); /* Show when active on mobile */
    }
}

/* Updated sidebar menu styles */
.submenu-toggle {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
}

.submenu-toggle svg {
    transition: transform 0.2s ease;
}

.submenu-toggle.active svg {
    transform: rotate(180deg);
}

.submenu-toggle {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
}

.submenu-toggle > div {
    padding-right: 0.5rem; /* Add some spacing between text and arrow */
}

.submenu-toggle svg {
    transition: transform 0.2s ease;
    margin-left: auto; /* Pushes the arrow to the right */
}

.submenu-toggle.active svg {
    transform: rotate(180deg);
}