/* ===================================
   WMS Portal Forms Styles
   =================================== */

/* Reset default form styles */
.wms-form-container input,
.wms-form-container select,
.wms-form-container textarea {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Form Container */
.wms-form-container {
    background: var(--bg-white, #ffffff) !important;
    border-radius: 12px !important;
    padding: 30px !important;
    box-shadow: var(--shadow-md, 0 4px 6px rgba(0,0,0,0.1)) !important;
    margin-bottom: 30px !important;
}

.wms-form-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--primary-color);
}

.wms-form-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.wms-form-title i {
    color: var(--primary-color);
}

.wms-form-description {
    color: var(--text-muted);
    font-size: 15px;
    margin-top: 10px;
}

/* Form Sections */
.wms-form-section {
    margin-bottom: 35px !important;
    padding: 25px !important;
    background: var(--bg-light, #f8f9fa) !important;
    border-radius: 10px !important;
    border-left: 4px solid var(--primary-color, #3498db) !important;
}

.wms-form-section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wms-form-section-title i {
    font-size: 22px;
    color: var(--primary-color);
}

/* Form Groups */
.wms-form-group {
    margin-bottom: 20px;
}

/* Bootstrap Grid System */
.row {
    display: flex !important;
    flex-wrap: wrap !important;
    margin-right: -15px;
    margin-left: -15px;
}

.col-md-6 {
    flex: 0 0 50% !important;
    max-width: 50% !important;
    padding-right: 15px;
    padding-left: 15px;
}

.col-md-4 {
    flex: 0 0 33.333333% !important;
    max-width: 33.333333% !important;
    padding-right: 15px;
    padding-left: 15px;
}

.col-md-3 {
    flex: 0 0 25% !important;
    max-width: 25% !important;
    padding-right: 15px;
    padding-left: 15px;
}

/* Filter row - force single line ONLY for filter forms */
.wms-form-section form.filter-form .row {
    flex-wrap: nowrap !important;
    align-items: flex-end !important;
    gap: 15px !important;
}

.wms-form-section form.filter-form .row > div {
    flex-shrink: 0 !important;
}

/* Responsive: Stack on mobile */
@media (max-width: 768px) {
    .col-md-6,
    .col-md-4,
    .col-md-3 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

.wms-form-label {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    font-size: 14px;
}

.wms-form-label.required::after {
    content: " *";
    color: var(--danger-color);
}

.wms-form-control {
    width: 100% !important;
    padding: 12px 15px !important;
    border: 2px solid var(--border-color, #ecf0f1) !important;
    border-radius: 8px !important;
    font-size: 15px !important;
    transition: all 0.3s !important;
    background: var(--bg-white, #ffffff) !important;
    box-sizing: border-box !important;
}

.wms-form-control:focus {
    outline: none !important;
    border-color: var(--primary-color, #3498db) !important;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1) !important;
}

.wms-form-control:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* Select Inputs */
.wms-form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

/* Textarea */
.wms-form-textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

/* File Upload */
.wms-form-file {
    padding: 10px;
    cursor: pointer;
}

.wms-form-file::-webkit-file-upload-button {
    padding: 8px 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
}

.wms-form-file::-webkit-file-upload-button:hover {
    background: #2980b9;
}

/* Radio & Checkbox Groups */
.wms-radio-group,
.wms-checkbox-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.wms-radio-item,
.wms-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.wms-radio-item:hover,
.wms-checkbox-item:hover {
    border-color: var(--primary-color);
    background: rgba(52, 152, 219, 0.05);
}

.wms-radio-item input[type="radio"],
.wms-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.wms-radio-item input[type="radio"]:checked + label,
.wms-checkbox-item input[type="checkbox"]:checked + label {
    color: var(--primary-color);
    font-weight: 600;
}

/* Form Help Text */
.wms-form-help {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 5px;
    display: block;
}

/* Form Buttons */
.wms-btn-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.wms-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.wms-btn-primary {
    background: var(--primary-color);
    color: white;
}

.wms-btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.wms-btn-success {
    background: var(--success-color);
    color: white;
}

.wms-btn-success:hover {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.wms-btn-danger {
    background: var(--danger-color);
    color: white;
}

.wms-btn-danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.wms-btn-info {
    background: #17a2b8;
    color: white;
}

.wms-btn-info:hover {
    background: #138496;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.wms-btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.wms-btn-secondary:hover {
    background: #1e2d3d;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.wms-btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.wms-btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.wms-btn-lg {
    padding: 15px 40px;
    font-size: 18px;
}

.wms-btn-sm {
    padding: 8px 20px;
    font-size: 14px;
}

/* Info Boxes */
.wms-info-box {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.wms-info-box i {
    font-size: 20px;
    margin-top: 2px;
}

.wms-info-box.info {
    background: rgba(22, 160, 133, 0.1);
    border-left: 4px solid var(--info-color);
    color: #0e6655;
}

.wms-info-box.warning {
    background: rgba(243, 156, 18, 0.1);
    border-left: 4px solid var(--warning-color);
    color: #9c6c0e;
}

.wms-info-box.danger {
    background: rgba(231, 76, 60, 0.1);
    border-left: 4px solid var(--danger-color);
    color: #a93226;
}

.wms-info-box.success {
    background: rgba(39, 174, 96, 0.1);
    border-left: 4px solid var(--success-color);
    color: #1e7e5a;
}

/* Progress Indicator */
.wms-progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
}

.wms-progress-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--border-color);
    z-index: 1;
}

.wms-progress-step {
    position: relative;
    z-index: 2;
    text-align: center;
    flex: 1;
}

.wms-progress-step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-white);
    border: 3px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-weight: 700;
    transition: all 0.3s;
}

.wms-progress-step.active .wms-progress-step-circle {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.wms-progress-step.completed .wms-progress-step-circle {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.wms-progress-step-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Image Preview */
.wms-image-preview {
    margin-top: 15px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.wms-image-preview-item {
    width: 150px;
    height: 150px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    position: relative;
}

.wms-image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wms-image-preview-item .remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--danger-color);
    color: white;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat Styles */
.wms-chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 250px);
    background: var(--bg-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.wms-chat-header {
    padding: 20px 25px;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
}

.wms-chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
}

.wms-chat-user-info h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.wms-chat-user-info p {
    margin: 5px 0 0;
    font-size: 13px;
    opacity: 0.9;
}

.wms-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    background: var(--bg-light);
}

.wms-chat-message {
    display: flex;
    margin-bottom: 20px;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wms-chat-message.own {
    justify-content: flex-end;
}

.wms-chat-message-content {
    max-width: 70%;
    padding: 12px 18px;
    border-radius: 18px;
    position: relative;
}

.wms-chat-message.own .wms-chat-message-content {
    background: linear-gradient(135deg, var(--primary-color), #5dade2);
    color: white;
    border-bottom-right-radius: 4px;
}

.wms-chat-message:not(.own) .wms-chat-message-content {
    background: var(--bg-white);
    color: var(--text-dark);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.wms-chat-message-sender {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 5px;
}

.wms-chat-message-text {
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

.wms-chat-message-image {
    margin-top: 8px;
    max-width: 100%;
}

.wms-chat-message-image img {
    max-width: 300px;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
    border: 2px solid var(--border-color);
}

.wms-chat-message-image img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.wms-chat-message-time {
    font-size: 11px;
    margin-top: 5px;
    opacity: 0.8;
}

.wms-chat-input-container {
    padding: 20px 25px;
    background: var(--bg-white);
    border-top: 2px solid var(--border-color);
}

.wms-chat-input-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.wms-chat-input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 15px;
    transition: all 0.3s;
}

.wms-chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.wms-chat-send-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 18px;
}

.wms-chat-send-btn:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.wms-chat-send-btn:active {
    transform: scale(0.95);
}

/* Chat Attachment Button */
.wms-chat-attachment-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--bg-light);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 18px;
}

.wms-chat-attachment-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

/* Image Preview */
.wms-chat-image-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    margin-top: 12px;
    position: relative;
}

.wms-chat-image-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.preview-filename {
    flex: 1;
    font-size: 14px;
    color: var(--text-dark);
    font-weight: 500;
}

.wms-remove-preview-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--danger-color);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.wms-remove-preview-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* Empty State */
.wms-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.wms-empty-state i {
    font-size: 80px;
    color: var(--border-color);
    margin-bottom: 20px;
}

.wms-empty-state h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.wms-empty-state p {
    font-size: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .wms-form-container {
        padding: 20px;
    }

    .wms-form-section {
        padding: 15px;
    }

    .wms-btn-group {
        flex-direction: column;
    }

    .wms-btn {
        width: 100%;
        justify-content: center;
    }

    .wms-chat-message-content {
        max-width: 85%;
    }

    .wms-radio-group,
    .wms-checkbox-group {
        flex-direction: column;
        gap: 10px;
    }
}

/* Loading Spinner */
.wms-spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

/* Chat Conversations List */
.wms-chat-conversations-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.wms-conversation-card {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: var(--bg-white, #ffffff) !important;
    border: 2px solid var(--border-color, #ecf0f1) !important;
    border-radius: 12px !important;
    text-decoration: none !important;
    color: var(--text-dark, #2c3e50) !important;
    transition: all 0.3s !important;
    cursor: pointer;
}

.wms-conversation-card:hover {
    border-color: var(--primary-color, #3498db) !important;
    box-shadow: var(--shadow-md, 0 4px 6px rgba(0,0,0,0.1)) !important;
    transform: translateY(-2px) !important;
}

.wms-conversation-avatar {
    width: 60px;
    height: 60px;
    min-width: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color, #3498db), var(--info-color, #16a085));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
}

.wms-conversation-content {
    flex: 1;
    min-width: 0;
}

.wms-conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 10px;
}

.wms-conversation-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark, #2c3e50) !important;
    margin: 0;
    flex: 1;
}

.wms-conversation-time {
    font-size: 13px;
    color: var(--text-muted, #7f8c8d);
    white-space: nowrap;
}

.wms-conversation-preview {
    font-size: 14px;
    color: var(--text-muted, #7f8c8d);
    margin: 0 0 10px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wms-conversation-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wms-conversation-count {
    font-size: 13px;
    color: var(--text-muted, #7f8c8d);
    display: flex;
    align-items: center;
    gap: 5px;
}

.wms-conversation-badge {
    background: var(--danger-color, #e74c3c);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Responsive for conversations list */
@media (max-width: 768px) {
    .wms-conversation-card {
        padding: 15px;
    }

    .wms-conversation-avatar {
        width: 50px;
        height: 50px;
        min-width: 50px;
        font-size: 24px;
    }

    .wms-conversation-title {
        font-size: 16px;
    }

    .wms-conversation-preview {
        font-size: 13px;
    }
}

/* ===================================
   Warehouse Cards
   =================================== */

/* Grid Container */
.wms-warehouses-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    margin-left: -12px !important;
    margin-right: -12px !important;
}

.wms-warehouse-col {
    padding-left: 12px !important;
    padding-right: 12px !important;
    flex: 0 0 auto !important;
    width: 25% !important; /* 4 per row on large screens */
}

@media (max-width: 1199px) {
    .wms-warehouse-col {
        width: 33.333333% !important; /* 3 per row on medium screens */
    }
}

@media (max-width: 767px) {
    .wms-warehouse-col {
        width: 50% !important; /* 2 per row on small screens */
    }
}

@media (max-width: 575px) {
    .wms-warehouse-col {
        width: 100% !important; /* 1 per row on mobile */
    }
}

.wms-warehouse-card {
    background: var(--bg-white, #ffffff) !important;
    border: 2px solid var(--border-color, #ecf0f1) !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    max-width: 100% !important;
}

.wms-warehouse-card:hover {
    border-color: var(--primary-color, #3498db) !important;
    transform: translateY(-5px) !important;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15) !important;
}

/* Warehouse Image */
.wms-warehouse-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--bg-light, #f8f9fa);
}

.wms-warehouse-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.wms-warehouse-card:hover .wms-warehouse-image img {
    transform: scale(1.05);
}

.wms-warehouse-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-light, #f8f9fa) 0%, #e9ecef 100%);
    color: var(--text-muted, #6c757d);
}

.wms-warehouse-image-placeholder i {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.wms-warehouse-image-placeholder p {
    margin: 0;
    font-size: 14px;
}

/* Warehouse Content */
.wms-warehouse-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.wms-warehouse-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark, #2c3e50);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wms-warehouse-title i {
    color: var(--primary-color, #3498db);
}

/* Warehouse Details */
.wms-warehouse-detail {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    padding: 8px 0;
    color: var(--text-dark, #2c3e50);
    font-size: 14px;
}

.wms-warehouse-detail i {
    color: var(--primary-color, #3498db);
    margin-top: 2px;
    min-width: 16px;
}

/* Warehouse Pricing */
.wms-warehouse-pricing {
    background: var(--bg-light, #f8f9fa);
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    border-left: 4px solid var(--primary-color, #3498db);
}

.wms-price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color, #ecf0f1);
}

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

.wms-price-label {
    font-size: 13px;
    color: var(--text-muted, #6c757d);
    display: flex;
    align-items: center;
    gap: 8px;
}

.wms-price-label i {
    color: var(--primary-color, #3498db);
    font-size: 14px;
}

.wms-price-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--success-color, #27ae60);
}

/* Responsive Warehouse Cards */
@media (max-width: 768px) {
    .wms-warehouse-card {
        margin-bottom: 20px;
    }

    .wms-warehouse-image {
        height: 180px;
    }

    .wms-warehouse-title {
        font-size: 18px;
    }

    .wms-warehouse-detail {
        font-size: 13px;
    }
}
