/* NEW: A modern, professional design system */

/* 1. Global Variables & Reset */
:root {
    --color-primary: #1e6693;
    --color-primary-hover: #1b3e65;
    --color-background: #ffffff;
    --color-sidebar: #f8f9fa;
    --color-border: #dee2e6;
    --color-text-primary: #212529;
    --color-text-secondary: #6c757d;
    --color-success: #28a745;
    --color-error: #dc3545;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --border-radius: 2px; /* Slightly more rounded corners */
    --box-shadow: 0 4px 6px rgba(0,0,0,0.1); /* Soft shadow for depth */
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: var(--font-family);
    background-color: var(--color-background);
    color: var(--color-text-primary);
    overflow: hidden;
}

/* 2. Main Layout */
.layout-container {
    display: flex;
    height: 100vh;
}

.left-column {
    flex-basis: 360px; /* A bit wider for better spacing */
    flex-shrink: 0;
    background-color: var(--color-sidebar);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.right-content {
    flex-grow: 1;
    height: 100vh;
}

#map {
    width: 100%;
    height: 100%;
}

/* 3. Sidebar Styling */
.sidebar-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 16px;
    position: relative;
}

.title-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header h1 {
    font-size: 22px;
    margin: 0;
    color: var(--color-primary);
}

.sidebar-content {
    padding: 24px;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.sidebar-content p {
    color: var(--color-text-secondary);
    font-size: 15px;
    line-height: 1.5;
    margin-top: 5px;
    margin-bottom: 5px;
}
.sidebar-content p a,
.sidebar-content p a:visited {
  color: inherit;                
  text-decoration: underline;     
  transition: color 0.2s ease;    
}
.sidebar-content p a:hover {
  color: var(--color-primary);
}

.unstable-banner {
    background-color: #ffc107;
    color: #333;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
}

/* MODIFIED: Slide-in Menu Styles */
.menu-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius);
    transition: background-color 0.2s ease;
    z-index: 100; /* Ensure it's clickable */
}

.menu-toggle-btn:hover {
    background-color: #e9ecef;
}

.menu-toggle-btn span {
    width: 18px;
    height: 2px;
    background-color: var(--color-text-secondary);
    display: block;
    border-radius: 1px;
}

.main-menu {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 300px;
    background-color: var(--color-background);
    box-shadow: var(--box-shadow);
    z-index: 2000;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

.main-menu:not(.hidden) {
    transform: translateX(0);
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1500;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.menu-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.main-menu.hidden {
    pointer-events: none;
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.menu-header h2 {
    margin: 0;
    font-size: 20px;
}

.menu-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 4px;
}

.menu-content {
    overflow-y: auto;
    flex-grow: 1;
    display: flex; /* MODIFIED: To allow footer positioning */
    flex-direction: column; /* MODIFIED */
}

.menu-items-top {
    padding: 8px 0;
}

.menu-item {
    display: block;
    padding: 12px 24px;
    color: var(--color-text-primary);
    text-decoration: none;
    font-size: 15px;
    transition: background-color 0.2s;
}

.menu-item:hover {
    background-color: var(--color-sidebar);
}

.menu-user-info {
    padding: 16px 24px;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.menu-user-info strong {
    color: var(--color-text-primary);
}

/* NEW: Menu Footer Styling */
.menu-footer {
    margin-top: auto; /* Pushes this element to the bottom */
    padding: 2px 24px;
    text-align: center;
    font-size: 13px;
    font-style: italic;
    line-height: 1.5;
    color: var(--color-text-secondary);
    border-top: 1px solid var(--color-border);
}

.menu-footer a {
    color: inherit;
    text-decoration: underline;
    font-weight: 500;
}

.menu-footer a:hover {
    color: var(--color-primary);
}


/* 4. Form & Controls */
/* 4. NEW: Output Format Selector (Toggle Buttons) */
.output-format-selector {
    border: none;
    padding: 0;
    width: 100%;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.output-format-selector legend {
    font-size: 14px;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding: 0;
}

.toggle-buttons {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.toggle-buttons input[type="radio"] {
    display: none; /* Hide the actual radio button */
}

.toggle-buttons label {
    flex-grow: 1;
    text-align: center;
    padding: 12px;
    cursor: pointer;
    background-color: var(--color-background);
    color: var(--color-text-primary);
    transition: background-color 0.2s ease;
    user-select: none;
}
.toggle-buttons label:not(:last-child) {
    border-right: 1px solid var(--color-border);
}
.toggle-buttons label:hover {
    background-color: #e9ecef;
}

/* The "depressed" state for the selected button */
.toggle-buttons input[type="radio"]:checked + label {
    background-color: var(--color-primary);
    color: white;
    font-weight: 600;
}

.toggle-buttons label.disabled-option {
    opacity: 0.5;
    cursor: not-allowed;
    user-select: none; /* Prevents the text from being selected */
}

.toggle-buttons label.disabled-option:hover {
    background-color: var(--color-background); /* Resets background to its original color */
}

/* 5. Footer and Primary Button */
.sidebar-footer {
    margin-top: auto;
}

.process-btn {
    width: 100%;
    margin-top: 0.2rem;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background-color: var(--color-primary);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

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

.process-btn:active:not(:disabled) {
    transform: translateY(0);
}

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

/* 6. NEW: Status Message Styling */
.status-message {
    padding: 12px;
    font-size: 14px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    display: none; /* Hidden by default */
    text-align: center;
}
.status-message.success {
    display: block;
    background-color: #e9f7ec;
    color: var(--color-success);
    border: 1px solid var(--color-success);
}
.status-message.error {
    display: block;
    background-color: #fbebed;
    color: var(--color-error);
    border: 1px solid var(--color-error);
}

.status-message {
    padding: 12px;
    font-size: 14px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    display: none; 
    text-align: center;
    border: 1px solid transparent; 
}

.status-message.info,
.status-message.success,
.status-message.error {
    display: block;
}

.status-message.info {
    background-color: #e6f4ff; /* Light blue background */
    color: #0062a3;             /* Darker blue text */
    border-color: #0062a3;       /* Matching blue border */
}

/* Styles for the 'success' state */
.status-message.success {
    background-color: #e9f7ec;
    color: var(--color-success);
    border-color: var(--color-success);
}

/* Styles for the 'error' state */
.status-message.error {
    background-color: #fbebed;
    color: var(--color-error);
    border-color: var(--color-error);
}

/* 6. Authentication Form Specifics */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: var(--color-sidebar);
}

.auth-form {
    background-color: var(--color-background);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
    max-width: 400px;
}
.auth-form h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
    color: var(--color-primary)
}

.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}
.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    box-sizing: border-box;
    font-size: 16px;
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.2s;
}
.submit-btn:hover {
    background-color: var(--color-primary-hover);
}

.form-link {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}
.form-link a {
    color: var(--color-primary);
    text-decoration: none;
}
.form-link a:hover {
    text-decoration: underline;
}

#flash-container {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 320px; /* A bit wider to match the professional feel */
    z-index: 4000; /* Higher z-index to appear above everything */
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Base style for a single flash message, using your variables */
.flash {
    padding: 1rem;
    border-radius: var(--border-radius);
    color: #ffffff; /* White text for contrast */
    box-shadow: var(--box-shadow);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Added a bounce effect */
    font-size: 14px;
    font-weight: 500;
}

/* Animation classes to be added by JavaScript */
.flash.visible {
    opacity: 1;
    transform: translateX(0);
}

.flash.fade-out {
    opacity: 0;
    transform: translateX(100%);
}

/* Colors for different message categories using your variables */
.flash-success {
    background-color: var(--color-success);
}

.flash-danger { /* Added .flash-error to match your variable name */
    background-color: var(--color-error);
}

.flash-info {
    background-color: var(--color-primary); /* Using your primary color for info */
}

.flash-warning {
    background-color: #ffc107; /* A standard warning yellow */
}

.errors {
    color: var(--color-error);
    font-size: 13px;
    list-style: none;
    padding: 5px 0 0 0;
    margin: 0;
}

hr.separator {
    border: none;                   /* Removes the default 3D browser style */
    height: 1px;                    /* Makes the line very thin */
    background-color: #e0e0e0;      /* A light gray color */
    margin: 10px 0;                 /* Adds vertical space above and below the line */
}

.form-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--color-sidebar);
    padding: 20px;
    box-sizing: border-box;
}

.form-container {
    background-color: var(--color-background);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
    max-width: 450px;
}

.form-container-wide {
    background-color: var(--color-background);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
    max-width: 900px;
}

.form-container-wide h3 {
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    letter-spacing: 0.5px;
    margin-top: 20px; /* Add some space above the header */
    margin-bottom: 5px;
    padding: 0;
}

.form-container-wide p {
    font-family: var(--font-family);
    color: var(--color-text-primary);
    margin-top: 5px;
    margin-bottom: 10px;
}

.form-container-wide h2 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 30px;
    font-size: 24px;
    color: var(--color-primary)
}

.form-container h2 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 30px;
    font-size: 24px;
    color: var(--color-primary)
}

/* Form Fields */
.form-field {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding: 0;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    box-sizing: border-box;
    font-size: 16px;
    font-family: var(--font-family);
}

/* Checkbox Specifics */
.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-checkbox label {
    font-weight: normal;
    margin-bottom: 0;
}

/* Account Page Specifics */
.form-container p {
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text-secondary);
}

.form-container p strong {
    color: var(--color-text-primary);
}

.form-container hr {
    border: none;
    height: 1px;
    background-color: #e0e0e0;
    margin: 30px 0;
}

/* License Status Badges */
[class^="status-"] {
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
    color: white;
}

.status-active {
    background-color: var(--color-success);
}

.status-expired,
.status-invalid {
    background-color: var(--color-error);
}

.status-pending {
    background-color: #ffc107;
    color: #333;
}

.form-input-static {
    /* Remove box styling */
    border: none;
    background-color: transparent;
    padding: 0;

    /* Adjust text and spacing */
    font-size: 16px;
    font-family: var(--font-family);
    color: var(--color-text-primary);
    margin-top: 4px;
    min-height: 27px;
    display: flex;
    align-items: center; 
}

/* 7. Cookie Banner & Policy Page Styles */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--color-text-primary);
    color: var(--color-background);
    padding: 15px 30px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 3000;
    box-sizing: border-box;
}

.cookie-banner.hidden {
    display: none;
}

.cookie-banner p {
    margin: 0;
    font-size: 14px;
}

.cookie-banner a {
    color: var(--color-background);
    text-decoration: underline;
    font-weight: 600;
}

.cookie-btn {
    background-color: var(--color-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    margin-left: 20px;
    transition: background-color 0.2s;
}

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

/* Table styling for cookie policy page */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 5px 0;
    font-size: 15px;
}

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

th {
    background-color: var(--color-sidebar);
    font-weight: 600;
}

.inline-header {
    display: flex;          /* Arranges children (h3 and p) in a row */
    align-items: baseline;  /* Aligns the text along their baselines */
    gap: 8px;               /* Adds a small space between the two elements */
}
/*
 * Styles for any disabled fieldset with the class 'output-format-selector'.
 * This provides the "greyed-out" effect.
 */

/* Target the fieldset by its class when it has the 'disabled' attribute */
.output-format-selector:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transition: opacity 0.3s ease-in-out;
}

/* Style the legend within the disabled fieldset */
.output-format-selector:disabled legend {
  color: #999;
}

/* Style the labels that act as buttons inside the toggle */
.output-format-selector:disabled .toggle-buttons label {
  background-color: #e9ecef; /* A light, flat grey */
  color: #aaa;
  cursor: not-allowed;
  box-shadow: none; /* Remove shadow to look inactive */
}

/* Prevent hover effects when disabled */
.output-format-selector:disabled .toggle-buttons label:hover {
  background-color: #e9ecef;
}

/* Make sure the selected option also looks disabled */
.output-format-selector:disabled .toggle-buttons input[type="radio"]:checked + label {
    background-color: #d6d9dc; /* A slightly darker grey for the selected option */
    color: #999;
}

/* ADD THIS: A hidden utility class */
.hidden {
    display: none !important;
}

/* ADD THIS: New Cancel Button Styling */
.cancel-btn {
    width: 100%;
    margin-top: 0.5rem; /* Add some space above */
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background-color: var(--color-error); /* Use the existing error color */
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.cancel-btn:hover:not(:disabled) {
    background-color: #a72834; /* A darker red for hover */
    transform: translateY(-1px);
}

.cancel-btn:active:not(:disabled) {
    transform: translateY(0);
}

.cancel-btn:disabled {
    background-color: #ced4da; /* Same disabled style as the process button */
    cursor: not-allowed;
}

.status-active, .status-expired {
    padding: 3px 8px;
    border-radius: 5px;
    font-weight: 500;
}

.status-active {
    color: var(--color-success); /* Uses your existing green variable */
    background-color: rgba(40, 167, 69, 0.1);
}

.status-expired {
    color: var(--color-error); /* Uses your existing red variable */
    background-color: rgba(220, 53, 69, 0.1);
}


/* 2. Styling for the '(Expires soon)' warning text */
.expiry-warning {
    color: var(--color-error); /* Uses your existing red variable */
    font-weight: bold;
    margin-left: 10px;
}


/* 3. Styling for the yellow 'warning' flash message */
.flash-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 5px solid #ffc107;
}

/* 4. Smooth fade-out transition for all flash messages */
.flash {
    transition: opacity 0.5s ease-out;
}
