/**
 * Cem Porcento Moodboard - Main Styles
 * Version: 1.0.0
 */

/* General Styles */
.cpm-moodboard-container * {
    box-sizing: border-box;
}

/* Typography */
.cpm-moodboard-container {
    font-family: "Sinkin Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Ensure canvas text uses Sinkin Sans */
.canvas-container {
    font-family: "Sinkin Sans", sans-serif !important;
}

/* Buttons */
.cpm-btn,
.button.cpm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: #F48120;
    color: white;
    border: 1px solid #F48120;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cpm-btn:hover,
.button.cpm-btn:hover {
    background: #FFF;
    color: #F48120;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(217, 83, 79, 0.3);
}

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

.cpm-btn.secondary {
    background: #6c757d;
}

.cpm-btn:disabled,
.cpm-btn.disabled,
.btn-toolbar:disabled,
.btn-toolbar.disabled,
.btn-delete-selected:disabled,
.btn-delete-selected.disabled {
    background: #cccccc !important;
    color: #666666 !important;
    cursor: not-allowed !important;
    opacity: 0.6;
    pointer-events: none;
}

/* Group/Ungroup buttons */
.btn-group:hover .dashicons-admin-links,
.btn-ungroup:hover .dashicons-editor-unlink {
    color: #D9534F;
}

/* Context menu styles */
.context-menu {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 0;
    z-index: 10000;
    min-width: 150px;
}

.context-menu-item {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background 0.2s;
}

.context-menu-item:hover {
    background: #f5f5f5;
}

.cpm-btn.secondary:hover {
    background: #5a6268;
}

.cpm-btn.success {
    background: #28a745;
}

.cpm-btn.success:hover {
    background: #218838;
}

.cpm-btn.info {
    background: #17a2b8;
}

.cpm-btn.info:hover {
    background: #138496;
}

/* Loading States */
.cpm-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,.1);
    border-radius: 50%;
    border-top-color: #D9534F;
    animation: cpm-spin 0.8s linear infinite;
}

@keyframes cpm-spin {
    to { transform: rotate(360deg); }
}

.cpm-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.cpm-loading-container {
    text-align: center;
}

.cpm-loading-container .cpm-loading {
    width: 40px;
    height: 40px;
    margin: 0 auto 20px;
}

/* Alerts and Messages */
.cpm-alert {
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    position: relative;
}

.cpm-alert.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.cpm-alert.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.cpm-alert.warning {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
}

.cpm-alert.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.cpm-alert-close {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.5;
}

.cpm-alert-close:hover {
    opacity: 1;
}

/* Canvas A4 Format */
.moodboard-canvas-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-start; /* Align to top */
    justify-content: center;
    padding: 20px;
    background: #f5f5f5;
}

.moodboard-canvas-inner {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
    width: 100%;
    max-width: 794px; /* A4 width at 96 DPI */
    margin: 0 auto;
}

.canvas-title-container {
    padding: 20px;
    /* Removed border-bottom */
    background: white;
    text-align: center;
}

.canvas-title-container h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}

.moodboard-canvas-container {
    padding: 20px;
    position: relative;
}

#moodboard-canvas {
    width: 100%;
    display: block;
    margin: 0 auto;
}

/* Canvas container responsive */
@media (max-width: 850px) {
    .moodboard-canvas-inner {
        max-width: 100%;
    }
    
    .moodboard-canvas-wrapper {
        padding: 10px;
    }
}

/* Ensure proper fabric canvas wrapper styling */
.canvas-container {
    margin: 0 auto !important;
}

/* Form Elements */
.cpm-form-group {
    margin-bottom: 20px;
}

.cpm-form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
}

.cpm-form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.cpm-form-control:focus {
    outline: none;
    border-color: #D9534F;
    box-shadow: 0 0 0 0.2rem rgba(217, 83, 79, 0.25);
}

.cpm-form-control.error {
    border-color: #dc3545;
}

.cpm-form-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
}

.cpm-form-error {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #dc3545;
}

/* Cards */
.cpm-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.cpm-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.cpm-card-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.cpm-card-body {
    padding: 20px;
}

.cpm-card-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

/* Grid System */
.cpm-row {
    display: flex;
    flex-wrap: wrap;
    margin: -10px;
}

.cpm-col {
    flex: 1;
    padding: 10px;
    min-width: 0;
}

.cpm-col-auto {
    flex: 0 0 auto;
    padding: 10px;
}

.cpm-col-12 { flex: 0 0 100%; }
.cpm-col-6 { flex: 0 0 50%; }
.cpm-col-4 { flex: 0 0 33.333%; }
.cpm-col-3 { flex: 0 0 25%; }

/* Tooltips */
.cpm-tooltip {
    position: relative;
    display: inline-block;
}

.cpm-tooltip-text {
    visibility: hidden;
    background-color: #333;
    color: white;
    text-align: center;
    padding: 5px 10px;
    border-radius: 4px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
    font-size: 12px;
}

.cpm-tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.cpm-tooltip:hover .cpm-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Badges */
.cpm-badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 3px;
    text-transform: uppercase;
}

.cpm-badge.primary {
    background: #D9534F;
    color: white;
}

.cpm-badge.success {
    background: #28a745;
    color: white;
}

.cpm-badge.warning {
    background: #ffc107;
    color: #333;
}

.cpm-badge.info {
    background: #17a2b8;
    color: white;
}

/* Utilities */
.cpm-text-center { text-align: center; }
.cpm-text-left { text-align: left; }
.cpm-text-right { text-align: right; }

.cpm-mt-0 { margin-top: 0; }
.cpm-mt-1 { margin-top: 10px; }
.cpm-mt-2 { margin-top: 20px; }
.cpm-mt-3 { margin-top: 30px; }

.cpm-mb-0 { margin-bottom: 0; }
.cpm-mb-1 { margin-bottom: 10px; }
.cpm-mb-2 { margin-bottom: 20px; }
.cpm-mb-3 { margin-bottom: 30px; }

.cpm-p-0 { padding: 0; }
.cpm-p-1 { padding: 10px; }
.cpm-p-2 { padding: 20px; }
.cpm-p-3 { padding: 30px; }

.cpm-d-none { display: none; }
.cpm-d-block { display: block; }
.cpm-d-flex { display: flex; }
.cpm-d-inline { display: inline; }
.cpm-d-inline-block { display: inline-block; }

.cpm-justify-center { justify-content: center; }
.cpm-justify-between { justify-content: space-between; }
.cpm-align-center { align-items: center; }

/* Responsive */
@media (max-width: 1200px) {
    .cpm-col-lg-12 { flex: 0 0 100%; }
    .cpm-col-lg-6 { flex: 0 0 50%; }
    .cpm-col-lg-4 { flex: 0 0 33.333%; }
}

@media (max-width: 992px) {
    .cpm-col-md-12 { flex: 0 0 100%; }
    .cpm-col-md-6 { flex: 0 0 50%; }
    .cpm-col-md-4 { flex: 0 0 33.333%; }
}

@media (max-width: 768px) {
    .cpm-col-sm-12 { flex: 0 0 100%; }
    .cpm-col-sm-6 { flex: 0 0 50%; }
    
    .cpm-row {
        margin: -5px;
    }
    
    .cpm-col,
    .cpm-col-auto {
        padding: 5px;
    }
}

@media (max-width: 576px) {
    .cpm-col,
    .cpm-col-6,
    .cpm-col-4,
    .cpm-col-3 {
        flex: 0 0 100%;
    }
}

/* Editor Container Override Styles */
.cpm-editor-container {
    min-height: 600px !important;
    display: flex;
    flex-direction: column;
}

.cpm-editor-workspace {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 500px !important;
    height: auto !important;
}

.cpm-sidebar-right {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

.cpm-canvas-container {
    background: transparent !important;
    padding: 0 !important;
}

/* Products sidebar sections */
.cpm-sidebar-right .sidebar-section {
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 10px;
}

/* Print Styles */
@media print {
    .cpm-no-print,
    .cpm-editor-header,
    .cpm-sidebar-left,
    .cpm-sidebar-right,
    .cpm-btn,
    .btn-action {
        display: none !important;
    }
    
    .cpm-canvas-container {
        border: none !important;
        box-shadow: none !important;
    }
}