/**
 * Intigo Parcel Creator V2 - Styles
 * Modern, responsive styling for the refactored parcel creation flow
 */

/* Modal Styles */
.intigo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

.intigo-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

.intigo-modal .modal-content {
    position: relative;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    margin: 5vh auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header */
.intigo-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.intigo-modal .modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.intigo-modal .modal-header .close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.intigo-modal .modal-header .close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Modal Body */
.intigo-modal .modal-body {
    padding: 24px;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

/* Form Styles */
#intigo-parcel-form-v2 {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-weight: 500;
    font-size: 14px;
    color: #374151;
    margin-bottom: 2px;
}

.form-group label::after {
    content: '';
}

.form-group label:has(+ input[required])::after,
.form-group label:has(+ textarea[required])::after {
    content: ' *';
    color: #ef4444;
}

/* Input Styles */
.form-group input,
.form-group textarea {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: #fff;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input.valid {
    border-color: #10b981;
    background: #f0fdf4;
}

.form-group input.invalid {
    border-color: #ef4444;
    background: #fef2f2;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Field Validation */
.field-validation {
    font-size: 12px;
    min-height: 16px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.field-validation.valid {
    color: #10b981;
    font-weight: 500;
}

.field-validation.invalid {
    color: #ef4444;
    font-weight: 500;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
    margin-top: 8px;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 100px;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f9fafb;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Create Parcel Button */
.create-intigo-parcel-v2 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.create-intigo-parcel-v2:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    color: white;
    text-decoration: none;
}

.create-intigo-parcel-v2:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.create-intigo-parcel-v2::before {
    content: '📦';
    font-size: 12px;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 10;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    margin: 0;
    color: #6b7280;
    font-weight: 500;
}

/* Notifications */
.intigo-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: notificationSlideIn 0.3s ease-out;
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.intigo-notification.success {
    background: #10b981;
    color: white;
}

.intigo-notification.error {
    background: #ef4444;
    color: white;
}

.intigo-notification .message {
    flex: 1;
    font-weight: 500;
    font-size: 14px;
}

.intigo-notification .close {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.intigo-notification .close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Body Modal Open */
body.modal-open {
    overflow: hidden;
}

/* Responsive Design */
@media (max-width: 768px) {
    .intigo-modal .modal-content {
        width: 95%;
        margin: 2vh auto;
        max-height: 96vh;
    }
    
    .intigo-modal .modal-header {
        padding: 16px 20px;
    }
    
    .intigo-modal .modal-body {
        padding: 20px;
        max-height: calc(96vh - 120px);
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .intigo-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .intigo-modal .modal-content {
        border: 2px solid #000;
    }
    
    .form-group input,
    .form-group textarea {
        border-width: 2px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .intigo-modal .modal-content,
    .intigo-notification,
    .btn,
    .create-intigo-parcel-v2,
    .form-group input,
    .form-group textarea {
        animation: none;
        transition: none;
    }
    
    .spinner {
        animation: none;
        border-top-color: transparent;
    }
}

/* Print Styles */
@media print {
    .intigo-modal,
    .intigo-notification {
        display: none !important;
    }
}