/**
 * Riedmair Checkout Manager - Shipping Selector Styles
 * Mobile-first approach
 */

/* ==============================================
   RESET & BASE
   ============================================== */

.riedmair-cm-shipping-selector {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.riedmair-cm-shipping-selector * {
    box-sizing: border-box;
}

/* ==============================================
   HEADER
   ============================================== */

.rcm-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e5e5e5;
}

.rcm-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: #333;
}

.rcm-subtitle {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* ==============================================
   WARENKORB-ÜBERSICHT
   ============================================== */

.rcm-cart-summary {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.rcm-cart-summary h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #333;
}

.rcm-cart-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rcm-cart-items li {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e5e5e5;
}

.rcm-cart-items li:last-child {
    border-bottom: none;
}

.rcm-icon {
    font-size: 24px;
    margin-right: 12px;
}

.rcm-item-name {
    font-size: 15px;
    font-weight: 500;
    color: #333;
}

/* ==============================================
   SEKTIONEN
   ============================================== */

.rcm-section {
    background: #fff;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.rcm-section-title {
    display: flex;
    align-items: center;
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 20px 0;
    color: #333;
}

.rcm-section-icon {
    font-size: 28px;
    margin-right: 10px;
}

.rcm-section-count {
    font-size: 16px;
    font-weight: 400;
    color: #666;
    margin-left: 8px;
}

.rcm-section-info {
    background: #e7f3ff;
    border-left: 4px solid #2196F3;
    padding: 12px 15px;
    margin: 0;
    font-size: 14px;
    color: #333;
    border-radius: 4px;
}

/* ==============================================
   OPTIONEN
   ============================================== */

.rcm-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rcm-option {
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
    background: #fff;
}

.rcm-option:hover {
    border-color: #5C462B;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.rcm-option-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    margin: 0;
}

.rcm-radio {
    margin: 4px 12px 0 0;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
}

.rcm-option-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rcm-option-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: block;
}

.rcm-option-desc {
    font-size: 13px;
    color: #666;
    display: block;
    line-height: 1.4;
}

.rcm-option-price {
    font-size: 14px;
    font-weight: 600;
    color: #2196F3;
    display: block;
    margin-top: 5px;
}

.rcm-price-free {
    color: #5C462B;
}

/* Aktive Option */
input[type="radio"]:checked + .rcm-option-content .rcm-option-title {
    color: #5C462B;
}

/* ==============================================
   EXTRA FELDER (Empfänger, Abhol-Details)
   ============================================== */

.rcm-option-extra {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e5e5;
}

.rcm-direct-recipients {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rcm-direct-recipients label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.rcm-input-number {
    width: 100%;
    max-width: 150px;
    padding: 10px;
    border: 2px solid #e5e5e5;
    border-radius: 4px;
    font-size: 16px;
}

.rcm-recipients-info {
    font-size: 13px;
    color: #666;
    margin-left: 10px;
}

.rcm-cost-preview {
    background: #e7f3ff;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
}

.rcm-cost-amount {
    font-weight: 700;
    color: #2196F3;
    margin-left: 5px;
}

/* ==============================================
   ABHOL-DETAILS FELDER
   ============================================== */

.rcm-pickup-details {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rcm-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rcm-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.rcm-select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e5e5e5;
    border-radius: 4px;
    font-size: 15px;
    background: #fff;
    cursor: pointer;
}

.rcm-select:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    color: #999;
}

.rcm-select:focus {
    border-color: #5C462B;
    outline: none;
}

/* ==============================================
   FEHLER
   ============================================== */

.rcm-errors {
    margin: 20px 0;
}

.rcm-errors .woocommerce-error {
    background: #fee;
    border-left: 4px solid #f44336;
    padding: 15px;
    margin: 0;
    font-size: 14px;
    border-radius: 4px;
}

/* ==============================================
   BUTTONS
   ============================================== */

.rcm-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e5e5e5;
}

.rcm-btn {
    display: inline-block;
    width: 100%;
    padding: 15px 25px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.rcm-btn-primary {
    background: #5C462B;
    color: #fff;
}

.rcm-btn-primary:hover {
    background: #4a3722;
}

.rcm-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.rcm-btn-secondary {
    background: #fff;
    color: #333;
    border: 2px solid #e5e5e5;
}

.rcm-btn-secondary:hover {
    border-color: #5C462B;
    color: #5C462B;
}

/* ==============================================
   CHECKOUT VALIDIERUNGS-HINWEIS
   ============================================== */

.riedmair-cm-selection-summary {
    background: #e7f7e7;
    border-left: 4px solid #5C462B;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.riedmair-cm-selection-summary h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #333;
}

.riedmair-cm-selection-summary p {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.6;
}

.riedmair-cm-selection-summary a {
    color: #5C462B;
    text-decoration: none;
    font-weight: 600;
}

.riedmair-cm-selection-summary a:hover {
    text-decoration: underline;
}

/* ==============================================
   RESPONSIVE: TABLET & DESKTOP
   ============================================== */

@media (min-width: 768px) {
    .riedmair-cm-shipping-selector {
        padding: 30px;
    }
    
    .rcm-header h1 {
        font-size: 32px;
    }
    
    .rcm-subtitle {
        font-size: 16px;
    }
    
    .rcm-section {
        padding: 30px;
    }
    
    .rcm-actions {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .rcm-btn {
        width: auto;
        min-width: 200px;
    }
    
    .rcm-btn-secondary {
        order: -1;
    }
    
    .rcm-direct-recipients {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
    }
    
    .rcm-pickup-details {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
    }
}

/* ==============================================
   RESPONSIVE: LARGE DESKTOP
   ============================================== */

@media (min-width: 1024px) {
    .riedmair-cm-shipping-selector {
        padding: 40px;
    }
}

/* ==============================================
   ACCESSIBILITY
   ============================================== */

.rcm-radio:focus {
    outline: 2px solid #5C462B;
    outline-offset: 2px;
}

.rcm-select:focus,
.rcm-input-number:focus {
    outline: 2px solid #5C462B;
    outline-offset: 2px;
}

/* ==============================================
   LOADING STATES
   ============================================== */

.rcm-select.loading {
    background-image: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 50 50"><circle cx="25" cy="25" r="20" fill="none" stroke="%234CAF50" stroke-width="5" stroke-dasharray="31.415, 31.415" stroke-linecap="round"><animateTransform attributeName="transform" type="rotate" dur="1s" repeatCount="indefinite" from="0 25 25" to="360 25 25"/></circle></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px 20px;
}

/* ==============================================
   EMPFÄNGER-ANZAHL UND KOSTEN
   ============================================== */

.rcm-direct-recipients {
    display: block !important;
    margin-top: 15px;
}

.rcm-recipients-config {
    width: 100%;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 20px;
}

.rcm-recipients-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.rcm-recipients-selector label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.rcm-recipients-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rcm-input-number {
    width: 80px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.rcm-recipients-info {
    font-size: 13px;
    color: #666;
}

.rcm-cost-preview {
    padding: 10px;
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    border-radius: 4px;
    font-size: 14px;
}

.rcm-cost-preview .rcm-cost-amount {
    font-weight: 600;
    color: #5C462B;
    margin-left: 5px;
}

/* ==============================================
   EMPFÄNGER-ADRESSEN
   ============================================== */

.rcm-recipient-addresses-wrapper {
    width: 100%;
    clear: both;
}

.rcm-recipient-addresses {
    width: 100%;
}

.rcm-recipient-addresses h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #333;
}

.rcm-recipient-addresses .description {
    font-size: 13px;
    color: #666;
    margin: 0 0 15px 0;
}

#rcm-address-forms-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.rcm-address-form {
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.rcm-address-form.collapsed .rcm-address-form-fields {
    display: none;
}

.rcm-address-form.expanded {
    border-color: #5C462B;
    box-shadow: 0 2px 8px rgba(92, 70, 43, 0.1);
}

.rcm-address-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    cursor: pointer;
    transition: background 0.2s ease;
}

.rcm-address-form-header:hover {
    background: #e9ecef;
}

.rcm-address-form.expanded .rcm-address-form-header {
    background: #5C462B;
    color: white;
}

.rcm-address-form-header h5 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: #5C462B;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rcm-address-form.expanded .rcm-address-form-header h5 {
    color: white;
}

.rcm-address-form-header h5::before {
    content: '▶';
    font-size: 10px;
    transition: transform 0.3s ease;
}

.rcm-address-form.expanded .rcm-address-form-header h5::before {
    transform: rotate(90deg);
}

.rcm-address-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #ffc107;
    color: #000;
    font-weight: 500;
}

.rcm-address-form.filled .rcm-address-status {
    background: #28a745;
    color: white;
    content: '✓ Ausgefüllt';
}

.rcm-remove-address {
    background: #dc3545;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.rcm-remove-address:hover {
    background: #c82333;
    transform: scale(1.1);
}

.rcm-address-form-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px;
    background: #f8f9fa;
}

.rcm-field {
    display: flex;
    flex-direction: column;
}

.rcm-field label {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #555;
}

.rcm-field label .required {
    color: #dc3545;
    margin-left: 2px;
}

.rcm-field .rcm-input,
.rcm-field .rcm-select {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.2s ease;
    background: white;
}

.rcm-field .rcm-input:focus,
.rcm-field .rcm-select:focus {
    border-color: #5C462B;
    outline: none;
    box-shadow: 0 0 0 2px rgba(92, 70, 43, 0.1);
}

/* Zweispaltig nur für PLZ/Stadt */
.rcm-field-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 10px;
}

.rcm-field-half {
    grid-column: span 1;
}

.rcm-field-full {
    grid-column: span 1;
}

/* ==============================================
   PRINT STYLES
   ============================================== */

@media print {
    .rcm-actions,
    .rcm-btn {
        display: none;
    }
}
