/**
 * Quick Cart Admin Styles - Clean Three Column Layout
 *
 * Modern, professional admin interface with vertical tabs, settings, and live preview
 *
 * @package Quick_Cart
 * @since 1.0.0
 */

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */

.quickcart-admin-wrap {
    margin: 20px 20px 40px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.quickcart-admin-wrap * {
    box-sizing: border-box;
}

/* ==========================================================================
   Header
   ========================================================================== */

.quickcart-admin-header {
    margin-bottom: 20px;
}

.quickcart-admin-header h1 {
    font-size: 23px;
    font-weight: 400;
    margin: 0 0 8px;
    padding: 9px 0;
    line-height: 1.3;
    color: #1d2327;
}

.quickcart-subtitle {
    color: #646970;
    font-size: 14px;
    margin: 0 0 20px;
    line-height: 1.6;
}

/* ==========================================================================
   Three Column Layout
   ========================================================================== */

.quickcart-settings-wrapper {
    display: grid;
    grid-template-columns: 220px 1fr 400px;
    gap: 0px;
    align-items: start;
}

/* ==========================================================================
   Column 1: Vertical Tabs Navigation
   ========================================================================== */

.quickcart-vertical-tabs {
    background: #fff;
    position: sticky;
    top: 32px;
}

.quickcart-tab-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    color: #50575e;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 400;
    background: #357bb9;
    color: #fff;
}

.quickcart-tab-link:hover {
    background: #f6f7f7;
    color: #2271b1;
}

.quickcart-tab-link:focus {
    box-shadow: none;
}

.quickcart-tab-link.active {
    background: #fff;
    color: #333;
    font-weight: 600;
}

.quickcart-tab-link .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.quickcart-tab-link .tab-label {
    flex: 1;
}

/* ==========================================================================
   Column 2: Content Area (Settings)
   ========================================================================== */

.quickcart-content-area {
    background: #fff;
    border: 1px solid #c3c4c7;
    min-height: 600px;
    border-left: none;
    border-top: none;
}

/* Tab Panels */
.quickcart-tab-panel {
    display: none;
}

.quickcart-tab-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Settings Sections */
.quickcart-section {
    padding: 24px;
    border-bottom: 1px solid #dcdcde;
}

.quickcart-section:last-child {
    border-bottom: none;
}

.quickcart-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
    color: #1d2327;
}

.quickcart-section > .description {
    margin: 0 0 20px;
    font-size: 13px;
    color: #646970;
    line-height: 1.6;
}

/* Form Tables */
.quickcart-section .form-table {
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.quickcart-section .form-table th {
    width: 200px;
    padding: 16px 20px 16px 0;
    font-weight: 600;
    font-size: 14px;
    color: #1d2327;
    vertical-align: top;
    text-align: left;
}

.quickcart-section .form-table td {
    padding: 16px 0;
    vertical-align: top;
}

.quickcart-section .form-table tr {
    border-bottom: 1px solid #f6f7f7;
}

.quickcart-section .form-table tr:last-child {
    border-bottom: none;
}

.quickcart-section .form-table p.description {
    margin: 8px 0 0;
    font-size: 13px;
    color: #646970;
    line-height: 1.5;
}

.quickcart-section .form-table p.description strong {
    color: #1d2327;
    font-weight: 600;
}

.quickcart-section .form-table p.description code {
    background: #f6f7f7;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    color: #d63638;
    font-family: Consolas, Monaco, monospace;
}

/* Form Inputs */
.quickcart-section input[type="text"],
.quickcart-section input[type="number"] {
    padding: 8px 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #fff;
    line-height: 1.5;
}

.quickcart-section input[type="text"]:focus,
.quickcart-section input[type="number"]:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.quickcart-section input[type="number"] {
    width: 100px;
}

.quickcart-section .regular-text {
    width: 100%;
    max-width: 500px;
}

/* Radio Buttons */
.quickcart-section input[type="radio"] {
    margin: 0 8px 0 0;
    cursor: pointer;
}

.quickcart-section fieldset label {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #1d2327;
}

.quickcart-section fieldset label:last-child {
    margin-bottom: 0;
}

/* Checkboxes */
.quickcart-section input[type="checkbox"] {
    margin: 0 8px 0 0;
    cursor: pointer;
}

.quickcart-section label {
    font-size: 14px;
    color: #1d2327;
}

/* Visibility Options */
.quickcart-visibility-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quickcart-visibility-options label {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: #f6f7f7;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.quickcart-visibility-options label:hover {
    background: #e9ecef;
}

.quickcart-visibility-options input[type="checkbox"] {
    margin-right: 10px;
}

/* Icon Grid */
.quickcart-icon-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.quickcart-icon-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border: 2px solid #dcdcde;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.quickcart-icon-card:hover {
    border-color: #2271b1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.1);
}

.quickcart-icon-card.selected {
    border-color: #2271b1;
    background: #f0f6fc;
    box-shadow: 0 2px 8px rgba(34, 113, 177, 0.15);
}

.quickcart-icon-card.selected::before {
    content: "\f147";
    font-family: dashicons;
    position: absolute;
    top: 8px;
    right: 8px;
    color: #2271b1;
    font-size: 20px;
}

.quickcart-icon-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.quickcart-icon-preview {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2271b1;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.quickcart-icon-card:hover .quickcart-icon-preview {
    transform: scale(1.08);
}

.quickcart-icon-preview svg {
    width: 30px;
    height: 30px;
    color: #fff;
}

.quickcart-icon-label {
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    color: #1d2327;
}

/* Color Picker */
.wp-picker-container {
    display: inline-block;
}

.wp-picker-container .wp-color-result {
    height: 32px;
    border-radius: 4px;
    border: 1px solid #8c8f94;
    box-shadow: none;
    transition: border-color 0.2s ease;
}

.wp-picker-container .wp-color-result:hover {
    border-color: #2271b1;
}

.wp-picker-container .wp-color-result-text {
    padding-top: 1px;
    padding-bottom: 1px;
}

.wp-picker-container .button {
    padding: 0 0 0 50px;
}

/* Info Boxes */
.quickcart-info-box {
    background: #f0f6fc;
    border-left: 4px solid #0783be;
    padding: 14px 16px;
    margin: 16px 0;
    border-radius: 0 4px 4px 0;
}

.quickcart-info-box p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #1d2327;
}

.quickcart-warning-box {
    background: #fcf9e8;
    border-left: 4px solid #dba617;
    padding: 14px 16px;
    margin: 16px 0;
    border-radius: 0 4px 4px 0;
}

.quickcart-warning-box p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #1d2327;
}

/* Select2 Styling */
.select2-container--default .select2-selection--multiple {
    border: 1px solid #8c8f94;
    border-radius: 4px;
    min-height: 40px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: #2271b1;
    border: none;
    color: #fff;
    border-radius: 3px;
    padding: 4px 8px;
    margin: 4px 4px 0 0;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #fff;
    margin-right: 6px;
    opacity: 0.8;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #fff;
    opacity: 1;
}

/* ==========================================================================
   Column 3: Live Preview
   ========================================================================== */

.quickcart-preview-area {
    position: sticky;
    top: 32px;
}

.quickcart-preview-box {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    overflow: hidden;
}

.quickcart-preview-header {
    padding: 16px 20px;
    background: #f6f7f7;
    border-bottom: 1px solid #c3c4c7;
}

.quickcart-preview-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}

/* Preview Container */
.quickcart-preview-container {
    height: 320px;
    background: linear-gradient(135deg, #f6f7f9 0%, #e9ecef 100%);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 30px;
    position: relative;
}

/* Grid Pattern Background */
.quickcart-preview-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.5;
}

/* Floating Icon Preview */
.quickcart-preview-float {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    position: absolute;
}

.quickcart-preview-icon-inner {
    position: relative;
    width: 64px;
    height: 64px;
    background: #2271b1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.quickcart-preview-float:hover .quickcart-preview-icon-inner {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

.quickcart-preview-icon-inner svg {
    width: 30px;
    height: 30px;
    color: #fff;
}

.quickcart-preview-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ff4444;
    color: #fff;
    border-radius: 50%;
    min-width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: 3px solid #fff;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.3);
}

/* Mini Cart Preview */
.quickcart-mini-cart-preview {
    border-top: 1px solid #c3c4c7;
    max-height: 480px;
    overflow-y: auto;
    display: none;
}

.quickcart-preview-mini-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: #f6f7f7;
    border-bottom: 1px solid #dcdcde;
}

.quickcart-preview-mini-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}

.quickcart-preview-close {
    background: transparent;
    border: none;
    padding: 4px;
    opacity: 0.5;
    cursor: not-allowed;
}

.quickcart-preview-close svg {
    color: #50575e;
}

/* Preview Items */
.quickcart-preview-items {
    padding: 16px;
    background: #fafafa;
}

.quickcart-preview-item {
    display: flex;
    gap: 12px;
    padding: 14px;
    margin-bottom: 12px;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #dcdcde;
}

.quickcart-preview-item:last-child {
    margin-bottom: 0;
}

.quickcart-preview-item-image {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
}

.quickcart-preview-placeholder-img {
    width: 100%;
    height: 100%;
    background: #f0f0f1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quickcart-preview-placeholder-img svg {
    color: #c3c4c7;
}

.quickcart-preview-item-details {
    flex: 1;
    min-width: 0;
}

.quickcart-preview-item-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1d2327;
}

.quickcart-preview-qty {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f0f0f1;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
}

.quickcart-preview-qty-btn {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 3px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0.7;
    cursor: not-allowed;
}

.quickcart-preview-item-price {
    font-size: 14px;
    font-weight: 700;
    color: #2271b1;
    white-space: nowrap;
}

/* Preview Footer */
.quickcart-preview-footer {
    padding: 16px 20px;
    border-top: 1px solid #dcdcde;
    background: #fff;
}

.quickcart-preview-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
    font-size: 16px;
    color: #1d2327;
}

.quickcart-preview-total strong {
    color: #2271b1;
    font-size: 18px;
}

.quickcart-preview-checkout-btn {
    width: 100%;
    padding: 12px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: not-allowed;
    opacity: 0.9;
}

/* Preview Info */
.quickcart-preview-info {
    padding: 16px 20px;
    font-size: 13px;
    color: #646970;
    line-height: 1.6;
    background: #f6f7f7;
    border-top: 1px solid #c3c4c7;
}

.quickcart-preview-info p {
    margin: 0;
}

/* ==========================================================================
   Save Button Section
   ========================================================================== */

.quickcart-save-section {
    padding: 20px 24px;
    background: #f6f7f7;
    border-top: 1px solid #c3c4c7;
    border-radius: 0 0 4px 4px;
}

.quickcart-save-section .button-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    height: auto;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
    background: #2271b1;
    border-color: #2271b1;
    box-shadow: none;
    text-shadow: none;
    transition: all 0.2s ease;
}

.quickcart-save-section .button-primary:hover,
.quickcart-save-section .button-primary:focus {
    background: #135e96;
    border-color: #135e96;
    box-shadow: 0 2px 8px rgba(34, 113, 177, 0.2);
}

.quickcart-save-section .button-primary:active {
    transform: translateY(1px);
}

.quickcart-save-section .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   Notices
   ========================================================================== */

.quickcart-admin-wrap .notice {
    margin: 0 0 20px;
    border-left-width: 4px;
    border-radius: 4px;
}

.quickcart-admin-wrap .notice-success {
    border-left-color: #00a32a;
    background: #f0f6fc;
}

.quickcart-admin-wrap .notice p {
    margin: 0.5em 0;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 1440px) {
    .quickcart-settings-wrapper {
        grid-template-columns: 180px 1fr 300px;
    }
}

@media (max-width: 1280px) {
    .quickcart-settings-wrapper {
        grid-template-columns: 180px 1fr 300px;
    }
    
    .quickcart-section .form-table th {
        width: 180px;
    }
}

@media (max-width: 1024px) {
    .quickcart-settings-wrapper {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .quickcart-vertical-tabs {
        position: relative;
        top: 0;
        display: flex;
        overflow-x: auto;
        padding: 8px;
    }
    
    .quickcart-tab-link {
        flex-shrink: 0;
        margin-right: 4px;
        margin-bottom: 0;
        min-width: 120px;
        justify-content: center;
    }
    
    .quickcart-tab-link.active {
        border-left-color: transparent;
        border-bottom: 2px solid #2271b1;
    }
    
    .quickcart-preview-area {
        position: relative;
        top: 0;
        order: -1;
    }
    
    .quickcart-section .form-table th {
        width: 200px;
    }
}

@media (max-width: 782px) {
    .quickcart-admin-wrap {
        margin: 10px 10px 20px 0;
    }
    
    .quickcart-section {
        padding: 20px;
    }
    
    .quickcart-section .form-table th,
    .quickcart-section .form-table td {
        display: block;
        width: 100%;
        padding: 12px 0;
    }
    
    .quickcart-section .form-table th {
        padding-bottom: 8px;
    }
    
    .quickcart-section .form-table td {
        padding-top: 0;
    }
    
    .quickcart-icon-grid {
        grid-template-columns: 1fr;
    }
    
    .quickcart-save-section {
        padding: 16px 20px;
    }
}

@media (max-width: 600px) {
    .quickcart-vertical-tabs {
        flex-direction: column;
    }
    
    .quickcart-tab-link {
        margin-right: 0;
        margin-bottom: 4px;
        min-width: 0;
        justify-content: flex-start;
    }
    
    .quickcart-tab-link.active {
        border-bottom: none;
        border-left: 2px solid #2271b1;
    }
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes slideIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.quickcart-admin-wrap .notice {
    animation: slideIn 0.3s ease;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.quickcart-tab-link:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.quickcart-icon-card:focus-within {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .quickcart-vertical-tabs,
    .quickcart-preview-area,
    .quickcart-save-section {
        display: none;
    }
    
    .quickcart-settings-wrapper {
        grid-template-columns: 1fr;
    }
}

.toplevel_page_quickcart-settings #wpfooter {
    position: relative;
}