/* Mattenplaner Styles */
.mattenplaner-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(85, 107, 47, 0.1);
    font-family: 'Raleway', sans-serif;
}

.mattenplaner-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #f0f0f0;
}

.mattenplaner-icon {
    font-size: 2.5rem;
    color: #556b2f;
    margin-bottom: 1rem;
}

.mattenplaner-header h1 {
    font-family: 'Drupadi', serif;
    font-size: 3rem;
    color: #556b2f;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.mattenplaner-header p {
    color: #666;
    font-size: 1.1rem;
    margin: 0;
}

.input-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.input-section h2 {
    font-family: 'Siffon', sans-serif;
    font-size: 1.4rem;
    color: #556b2f;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.section-header i {
    color: #556b2f;
    font-size: 1.2rem;
}

.input-section p {
    color: #666;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.dimension-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

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

.input-group label {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-unit input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    padding-right: 2.5rem;
}

.input-with-unit input:focus {
    outline: none;
    border-color: #556b2f;
    box-shadow: 0 0 0 3px rgba(85, 107, 47, 0.1);
}

.input-with-unit .unit {
    position: absolute;
    right: 0.75rem;
    color: #666;
    font-weight: 500;
    pointer-events: none;
}

.mat-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mat-option {
    position: relative;
}

.mat-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mat-option label {
    display: block;
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.mat-option label:hover {
    border-color: #556b2f;
    background: #f8f9fa;
}

.mat-option input[type="radio"]:checked + label {
    border-color: #556b2f;
    background: rgba(85, 107, 47, 0.05);
    position: relative;
}

.mat-option input[type="radio"]:checked + label::after {
    content: "✓";
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    color: #556b2f;
    font-weight: bold;
    font-size: 1.2rem;
}

.mat-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mat-name {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.mat-dimensions {
    color: #666;
    font-size: 0.9rem;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

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

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

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

input:checked + .toggle-slider {
    background-color: #556b2f;
}

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

.toggle-label {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.toggle-description {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
    font-style: italic;
}

.calculate-button {
    width: 100%;
    background: #556b2f;
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    margin-bottom: 1rem;
}

.calculate-button:hover {
    background: #4a5f2a;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(85, 107, 47, 0.3);
}

.info-notice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(85, 107, 47, 0.1);
    border: 1px solid rgba(85, 107, 47, 0.2);
    border-radius: 8px;
    color: #556b2f;
    font-size: 0.9rem;
}

.info-notice i {
    font-size: 1.1rem;
}

.results-container {
    margin-top: 2rem;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.results-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.results-icon {
    font-size: 2rem;
    color: #556b2f;
    margin-bottom: 0.5rem;
}

.results-header h2 {
    font-family: 'Drupadi', serif;
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    color: #556b2f;
    margin-bottom: 0.5rem;
    font-weight: bold;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
    white-space: normal;
    hyphens: auto;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
}

/* Mobile line break for Mattenlayout heading */
@media (max-width: 768px) {
    .results-header h2 {
        line-height: 1.2;
        font-size: clamp(1rem, 3.5vw, 1.5rem);
        display: grid;
        grid-template-columns: 1fr;
        gap: 0;
        text-align: center;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    
    .results-header h2 .mobile-break {
        display: block;
        width: 100%;
    }
}

@media (min-width: 769px) {
    .results-header h2 .mobile-break {
        display: none;
    }
}

.results-header p {
    color: #666;
    font-size: 1rem;
    margin: 0;
}

.calculation-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-label {
    color: #666;
    font-weight: 500;
    font-size: 0.95rem;
}

.summary-value {
    color: #333;
    font-weight: 600;
    font-size: 0.95rem;
}

.layout-visualization {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
    min-height: 200px;
    overflow-x: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.layout-container {
    max-width: 100%;
    height: auto;
    flex-shrink: 0;
    transform: scale(1);
    transform-origin: center;
}

.layout-grid {
    display: grid;
    gap: 2px;
    background: #f0f0f0;
    padding: 10px;
    border-radius: 4px;
    min-height: 150px;
}

.mat-element {
    background: #556b2f;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9rem;
    position: relative;
    min-height: 40px;
}

.mat-element.cut-mat {
    background: #f39c12;
}

.mat-dimensions {
    font-size: 0.7rem;
    margin-top: 0.25rem;
    opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .mattenplaner-container {
        max-width: 90%;
        margin: 1rem auto;
        padding: 1.5rem;
    }
    
    .mattenplaner-header h1 {
        font-size: 2.2rem;
    }
    
    .input-section h2 {
        font-size: 1.3rem;
    }
    
    .layout-container {
        transform: scale(0.9);
    }
}

@media (max-width: 768px) {
    .mattenplaner-container {
        margin: 0.75rem;
        padding: 1.25rem;
        max-width: calc(100% - 1.5rem);
    }
    
    .dimension-inputs {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .calculation-summary {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .mattenplaner-header h1 {
        font-size: 1.8rem;
        line-height: 1.2;
    }
    
    .input-section {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .input-section h2 {
        font-size: 1.2rem;
    }
    
    .results-container {
        padding: 1.25rem;
        margin-top: 1.5rem;
    }
    
    .mat-option label {
        padding: 0.75rem;
    }
    
    .mat-name {
        font-size: 0.9rem;
    }
    
    .mat-dimensions {
        font-size: 0.8rem;
    }
    
    .calculate-button {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .layout-container {
        transform: scale(0.8);
    }
    
    .layout-visualization {
        padding: 1rem;
    }
}

@media (max-width: 600px) {
    .mattenplaner-container {
        margin: 0.5rem;
        padding: 1rem;
        max-width: calc(100% - 1rem);
    }
    
    .mattenplaner-header h1 {
        font-size: 1.6rem;
    }
    
    .input-section h2 {
        font-size: 1.1rem;
    }
    
    .input-section p {
        font-size: 0.9rem;
    }
    
    .layout-visualization {
        padding: 0.75rem;
        min-height: 120px;
    }
    
    .mat-element {
        font-size: 0.7rem;
        min-height: 28px;
        padding: 2px;
    }
    
    .mat-dimensions {
        font-size: 0.6rem;
    }
    
    .layout-container {
        min-width: 180px;
    }
    
    .summary-item {
        padding: 0.375rem 0;
    }
    
    .summary-label,
    .summary-value {
        font-size: 0.85rem;
    }
    
    .toggle-container {
        gap: 0.75rem;
    }
    
    .toggle-label {
        font-size: 0.9rem;
    }
    
    .toggle-description {
        font-size: 0.8rem;
    }
    
    .layout-container {
        transform: scale(0.7);
    }
    
    .layout-visualization {
        padding: 0.75rem;
        min-height: 100px;
    }
    
    .layout-grid {
        padding: 8px;
        min-height: 120px;
    }
}

@media (max-width: 480px) {
    .mattenplaner-container {
        margin: 0.25rem;
        padding: 0.75rem;
        max-width: calc(100% - 0.5rem);
        border-radius: 12px;
    }
    
    .mattenplaner-header h1 {
        font-size: 1.4rem;
        line-height: 1.1;
    }
    
    .input-section {
        padding: 0.75rem;
        margin-bottom: 1rem;
        border-radius: 8px;
    }
    
    .input-section h2 {
        font-size: 1rem;
        margin-bottom: 0.375rem;
    }
    
    .input-section p {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }
    
    .results-container {
        padding: 1rem;
        margin-top: 1rem;
        border-radius: 8px;
    }
    
    .results-header h2 {
        font-size: clamp(0.9rem, 3vw, 1.2rem);
        line-height: 1.2;
    }
    
    .mat-element {
        font-size: 0.65rem;
        min-height: 24px;
        padding: 1px;
    }
    
    .mat-dimensions {
        font-size: 0.55rem;
    }
    
    .layout-visualization {
        padding: 0.5rem;
        min-height: 100px;
    }
    
    .layout-container {
        min-width: 150px;
    }
    
    .calculation-summary {
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .summary-item {
        padding: 0.25rem 0;
    }
    
    .summary-label,
    .summary-value {
        font-size: 0.8rem;
    }
    
    .mat-option label {
        padding: 0.625rem;
    }
    
    .mat-name {
        font-size: 0.85rem;
    }
    
    .mat-dimensions {
        font-size: 0.75rem;
    }
    
    .calculate-button {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
    }
    
    .info-notice {
        padding: 0.75rem;
        font-size: 0.8rem;
    }
    
    .toggle-container {
        gap: 0.5rem;
    }
    
    .toggle-label {
        font-size: 0.85rem;
    }
    
    .toggle-description {
        font-size: 0.75rem;
    }
    
    .layout-container {
        transform: scale(0.6);
    }
    
    .layout-visualization {
        padding: 0.5rem;
        min-height: 80px;
    }
    
    .layout-grid {
        padding: 6px;
        min-height: 100px;
    }
}

@media (max-width: 360px) {
    .mattenplaner-container {
        margin: 0.125rem;
        padding: 0.5rem;
        max-width: calc(100% - 0.25rem);
    }
    
    .mattenplaner-header h1 {
        font-size: 1.2rem;
    }
    
    .input-section {
        padding: 0.5rem;
    }
    
    .input-section h2 {
        font-size: 0.95rem;
    }
    
    .input-section p {
        font-size: 0.8rem;
    }
    
    .results-container {
        padding: 0.75rem;
    }
    
    .mat-element {
        font-size: 0.6rem;
        min-height: 20px;
    }
    
    .mat-dimensions {
        font-size: 0.5rem;
    }
    
    .calculate-button {
        padding: 0.625rem 1rem;
        font-size: 0.9rem;
    }
    
    .layout-container {
        transform: scale(0.5);
        min-width: 120px;
    }
    
    .layout-visualization {
        padding: 0.375rem;
        min-height: 60px;
    }
    
    .layout-grid {
        padding: 4px;
        min-height: 80px;
    }
}
