:root {
    --primary-color: #5e72e4;
    --primary-hover: #4a5fd7;
    --secondary-color: #475569;
    --secondary-hover: #334155;
    --alt-color: #5e72e4;
    --alt-hover: #4a5fd7;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --text-dark: #1e293b;
    --text-light: #94a3b8;
    --text-white: #f8fafc;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --border-light: #e2e8f0;
    --border-dark: #cbd5e1;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.07);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --transition: all 0.2s ease-in-out;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    scroll-behavior: smooth;
}

/* App container and header */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    background-color: var(--primary-color);
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    box-shadow: var(--shadow-sm);
    text-align: center;
    color: var(--text-white);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo svg {
    color: var(--text-white);
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-white);
}

.tagline {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
}

/* Main content layout */
.app-content {
    flex: 1;
    max-width: 900px; /* Reduced from 1200px */
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-panel {
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.25rem;
    width: 100%;
}

/* Two-column layout for input and controls */
.input-controls-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

@media (min-width: 768px) {
    .input-controls-layout {
        grid-template-columns: 3fr 2fr;
        align-items: start;
    }
}

.panel-header {
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
}

/* More compact textarea */
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    resize: vertical;
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.5;
    min-height: 140px; /* Slightly reduced */
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(94, 114, 228, 0.2);
}

/* Customization controls - more compact layout */
.customization-section {
    background-color: rgba(94, 114, 228, 0.05);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    border: 1px solid rgba(94, 114, 228, 0.1);
}

.customization-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.customization-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.customization-control {
    margin-bottom: 0.5rem;
}

.customization-control label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.85rem;
}

/* Textarea and info box */
.info-box {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    background-color: rgba(94, 114, 228, 0.1);
    margin-top: 1rem;
    font-size: 0.85rem;
}

.info-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.info-box p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--primary-color);
}

/* Action buttons */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.action-buttons.centered {
    justify-content: center;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
    white-space: nowrap;
}

.btn-icon {
    font-size: 1.125rem;
    line-height: 1;
}

.btn.primary {
    background-color: var(--primary-color);
    color: var(--text-white);
}

.btn.primary:hover, .btn.primary:focus {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-sm);
}

.btn.secondary {
    background-color: var(--secondary-color);
    color: var(--text-white);
}

.btn.secondary:hover, .btn.secondary:focus {
    background-color: var(--secondary-hover);
    box-shadow: var(--shadow-sm);
}

/* Preview and customization */
.preview-container {
    padding: 1rem;
    background-color: rgba(94, 114, 228, 0.05);
    border: 1px solid rgba(94, 114, 228, 0.2);
    border-radius: var(--radius-md);
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: auto;
    max-height: 150px;
    overflow: hidden;
}

.preview-title {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
}

.preview-label {
    transform: scale(0.3);
    transform-origin: top center;
    height: 30mm;
    width: 100mm;
    border: 1px solid var(--border-dark);
    margin: 0;
    background-color: white;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.preview-dimensions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-light);
}

.preview-dimensions .dimension-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.preview-dimensions .dimension-icon {
    width: 0.8rem;
    height: 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Customization controls */
.customization-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

@media (min-width: 768px) and (max-width: 991px) {
    .customization-controls {
        grid-template-columns: repeat(3, 1fr);
    }
}

.customization-control {
    margin-bottom: 0.75rem;
    position: relative;
}

.customization-control label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.customization-control .value {
    font-weight: 600;
    color: var(--primary-color);
    background-color: rgba(94, 114, 228, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.slider-container {
    position: relative;
}

.slider-container .slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-light);
}

.slider-description {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.25rem;
    font-style: italic;
}

.customization-control input[type="range"] {
    width: 100%;
    height: 6px;
    background-color: var(--border-light);
    border-radius: 3px;
    outline: none;
}

.customization-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: var(--primary-color);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

/* Status message */
.status-message {
    margin: 1rem 0;
    padding: 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    display: none;
    animation: fadeIn 0.3s ease-in-out;
    box-shadow: var(--shadow-sm);
}

/* Results section */
.results-section {
    padding: 1rem;
}

.results-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    text-align: center;
}

.barcode-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center; /* Center horizontally */
}

.barcode-label {
    width: 200mm;
    height: 60mm;
    max-width: 100%; /* Ensure it doesn't overflow on small screens */
    margin-left: auto;
    margin-right: auto;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    padding: 1mm;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    page-break-inside: avoid;
    page-break-after: always;
    background-color: white;
    box-sizing: border-box;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.barcode-label:hover {
    box-shadow: var(--shadow-md);
}

.barcode-svg {
    display: block;
    width: 99%;
    height: 45mm !important;
    margin: 1.5mm auto 0;
    max-height: 45mm;
    background-color: white;
}

img.barcode-svg {
    object-fit: contain;
    height: 45mm !important;
    width: auto;
    max-width: 99%;
    margin: 0;
}

.barcode-text {
    margin-top: auto;
    margin-bottom: 3mm;
    font-size: 40pt;
    font-weight: bold;
    text-align: center;
    max-width: 99%;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
    letter-spacing: -2px;
    color: #000000; /* Ensure text is black */
}

.barcode-text .dash {
    display: inline-block;
    width: 0.8em;
    height: 0.12em;
    background-color: #000;
    vertical-align: middle;
    margin: 0 0.1em;
}

/* Privacy notice with improved styling for GDPR compliance */
.privacy-notice {
    background-color: rgba(94, 114, 228, 0.05);
    border: 1px solid rgba(94, 114, 228, 0.1);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.privacy-notice h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.privacy-notice p {
    font-size: 0.9rem;
    color: var(--text-dark);
    line-height: 1.6;
    margin: 0;
    margin-bottom: 0.75rem;
}

.privacy-notice .privacy-detail {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.privacy-notice a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.privacy-notice a:hover {
    text-decoration: underline;
}

.privacy-section {
    margin-bottom: 1.25rem;
}

.privacy-list {
    padding-left: 1.25rem;
    margin-bottom: 1rem;
}

.privacy-list li {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.privacy-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.9rem;
}

.privacy-toggle:hover {
    text-decoration: underline;
}

.privacy-details {
    display: none;
    padding-top: 1rem;
}

.privacy-details.open {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

/* Enhanced footer with branding */
.app-footer {
    background-color: var(--secondary-color);
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: auto;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
}

.app-footer a {
    color: white;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.app-footer a:hover {
    text-decoration: underline;
    opacity: 0.9;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
}

.footer-branding {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.footer-branding img {
    height: 1.5rem;
    width: auto;
}

.footer-tagline {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* External resources modal styling */
.resources-info {
    margin-top: 1rem;
}

.info-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-md);
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.info-button:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

.info-button svg {
    width: 16px;
    height: 16px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal.open {
    display: flex;
    animation: fadeIn 0.3s ease-in-out;
}

.modal-content {
    background-color: var(--bg-white);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    border-radius: var(--radius-lg);
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease-out;
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: var(--text-dark);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-light);
    padding: 0.25rem;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: 1.5rem;
}

.resource-list {
    list-style-type: none;
    padding: 0;
}

.resource-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.resource-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.resource-item h4 {
    color: var(--primary-color);
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

.resource-item p {
    color: var(--text-dark);
    font-size: 0.9rem;
    margin: 0.5rem 0;
    line-height: 1.5;
}

.resource-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.resource-item a:hover {
    text-decoration: underline;
}

.resource-meta {
    color: var(--text-light);
    font-size: 0.85rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .app-content {
        padding: 2.5rem;
    }
    
    .action-buttons {
        justify-content: flex-end;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
}

/* Print styles */
@media print {
    body * {
        visibility: hidden;
    }
    
    .barcode-container, .barcode-container * {
        visibility: visible;
    }
    
    .barcode-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    
    .buttons, textarea, h1, p, .customization-panel, .input-panel, .app-header, .app-footer {
        display: none;
    }
    
    .barcode-label {
        border: none;
        padding: 0;
        width: 200mm;
        height: 60mm;
        box-shadow: none;
        margin-bottom: 0;
    }
    
    .barcode-svg {
        height: 45mm !important;
        margin: 1.5mm auto 0;
    }
    
    img.barcode-svg {
        height: 45mm !important;
    }
    
    .barcode-text {
        font-size: 40pt;
        margin-top: auto;
        margin-bottom: 3mm;
        letter-spacing: -2px;
    }
}
