/**
 * DTF Sheet Design Tool - Styles
 */

/* Mode Selector Modal */
.mode-card {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    height: 100%;
}

.mode-card:hover {
    border-color: #ffd700;
    box-shadow: 0 8px 16px rgba(255, 215, 0, 0.3);
    transform: translateY(-5px);
}

.mode-card .mode-icon {
    margin-bottom: 1rem;
    color: #ffd700;
}

.mode-card h4 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #000000;
}

.mode-card .feature-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    text-align: left;
}

.mode-card .feature-list li {
    padding: 0.5rem 0;
    font-size: 0.95rem;
}

/* Editor Overlay */
.dtf-tool-editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Editor Container */
.dtf-tool-editor-container {
    width: 95vw;
    height: 95vh;
    background: #1a1a1a;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Toolbar */
.dtf-tool-toolbar {
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #ffd700;
}

.dtf-tool-toolbar .toolbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dtf-tool-toolbar h5 {
    color: #ffffff;
    margin: 0;
    font-weight: 600;
}

.dtf-tool-toolbar .toolbar-right {
    display: flex;
    gap: 0.5rem;
}

.dtf-tool-toolbar .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Canvas Area */
.dtf-tool-canvas-area {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Canvas Wrapper - align canvas to top-left; extra top padding (20vh) so user can scroll up to reveal sheet top under toolbar */
.canvas-wrapper {
    flex: 1;
    background: #2a2a2a;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    overflow: auto;
    padding: calc(1rem + 20vh) 2rem calc(1rem + 20vh) 2rem;
}

#dtfCanvas {
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

/* Side Panel */
.dtf-tool-sidepanel {
    width: 300px;
    max-width: 300px;
    background: #1f1f1f;
    border-left: 1px solid #333333;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

.panel-section {
    padding: 0.75rem;
    border-bottom: 1px solid #333333;
    overflow-x: hidden; /* Prevent horizontal scroll in sections */
    box-sizing: border-box;
}

.panel-section h6 {
    color: #ffd700;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-section .info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    color: #cccccc;
    font-size: 0.8rem;
}

.panel-section .info-item span {
    color: #999999;
}

.panel-section .info-item strong {
    color: #ffffff;
    font-size: 0.85rem;
}

/* Layers List - COMPACT */
.layers-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.layer-item {
    background: #2a2a2a;
    border: 1px solid #333333;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.layer-item:hover {
    background: #333333;
    border-color: #ffd700;
}

.layer-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ffffff;
    font-size: 0.9rem;
    cursor: pointer;
    flex: 1;
}

.layer-info i {
    color: #ffd700;
}

.layer-actions {
    display: flex;
    gap: 0.25rem;
}

.layer-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* Scrollbar Styling */
.dtf-tool-sidepanel::-webkit-scrollbar,
.layers-list::-webkit-scrollbar {
    width: 8px;
}

.dtf-tool-sidepanel::-webkit-scrollbar-track,
.layers-list::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.dtf-tool-sidepanel::-webkit-scrollbar-thumb,
.layers-list::-webkit-scrollbar-thumb {
    background: #333333;
    border-radius: 4px;
}

.dtf-tool-sidepanel::-webkit-scrollbar-thumb:hover,
.layers-list::-webkit-scrollbar-thumb:hover {
    background: #444444;
}

/* Upload Section in DTF Sheet Page */
.dtf-upload-options {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.upload-option-card {
    flex: 1;
    min-width: 280px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-option-card:hover {
    border-color: #ffd700;
    box-shadow: 0 8px 16px rgba(255, 215, 0, 0.3);
    transform: translateY(-5px);
}

.upload-option-card i {
    font-size: 3rem;
    color: #ffd700;
    margin-bottom: 1rem;
}

.upload-option-card h4 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #000000;
}

.upload-option-card p {
    color: #666666;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.upload-option-card .btn {
    margin-top: 1rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .dtf-tool-sidepanel {
        width: 250px;
    }
}

@media (max-width: 992px) {
    .dtf-tool-editor-container {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
    
    .dtf-tool-sidepanel {
        position: absolute;
        right: -300px;
        top: 0;
        height: 100%;
        width: 300px;
        z-index: 100;
        transition: right 0.3s ease;
    }
    
    .dtf-tool-sidepanel.open {
        right: 0;
    }
    
    .canvas-wrapper {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .dtf-tool-toolbar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .dtf-tool-toolbar .toolbar-left,
    .dtf-tool-toolbar .toolbar-right {
        width: 100%;
        justify-content: center;
    }
    
    .upload-option-card {
        min-width: 100%;
    }
}

/* Loading Spinner */
.dtf-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #ffffff;
}

.dtf-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #333333;
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #999999;
}

.empty-state i {
    font-size: 4rem;
    color: #333333;
    margin-bottom: 1rem;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* Fabric.js Custom Styles */
.canvas-container {
    margin: 0 auto !important;
}

/* Zone Indicators */
.zone-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    padding: 1rem;
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.85rem;
    z-index: 100;
}

.zone-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.zone-legend-item:last-child {
    margin-bottom: 0;
}

.zone-color {
    width: 30px;
    height: 3px;
    border-radius: 2px;
}

.zone-color.bleed {
    background: #4ecdc4;
}

.zone-color.safety {
    background: #ff6b6b;
}

/* Tooltips */
.dtf-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 10000;
    white-space: nowrap;
}

/* Success/Error States */
.state-success {
    color: #28a745;
}

.state-error {
    color: #dc3545;
}

.state-warning {
    color: #ffc107;
}

/* Badge Styles */
.badge.bg-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%) !important;
}

.badge.bg-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%) !important;
}

/* Object Editing Toolbar */
.dtf-tool-object-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-bottom: 3px solid #ffd700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dtf-tool-object-toolbar .toolbar-label {
    display: flex;
    align-items: center;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.dtf-tool-object-toolbar .toolbar-label i {
    color: #ffd700;
    font-size: 1.1rem;
}

.dtf-tool-object-toolbar .toolbar-label strong {
    color: #ffd700;
    margin-left: 0.25rem;
}

.dtf-tool-object-toolbar .toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dtf-tool-object-toolbar .toolbar-divider {
    width: 2px;
    height: 28px;
    background: rgba(255, 215, 0, 0.3);
    margin: 0 0.25rem;
}

.dtf-tool-object-toolbar .btn {
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border-width: 2px;
}

.dtf-tool-object-toolbar .btn i {
    font-size: 1rem;
}

.dtf-tool-object-toolbar .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Undo/Redo buttons - Cyan/Teal theme */
.dtf-tool-object-toolbar .btn-outline-secondary {
    border-color: #38b2ac;
    color: #ffffff;
    background: rgba(56, 178, 172, 0.2);
}

.dtf-tool-object-toolbar .btn-outline-secondary:hover {
    background: #38b2ac;
    border-color: #38b2ac;
    color: #ffffff;
}

/* Duplicate button - Gold theme */
.dtf-tool-object-toolbar .btn-outline-primary {
    border-color: #ffd700;
    color: #ffd700;
    background: rgba(255, 215, 0, 0.15);
}

.dtf-tool-object-toolbar .btn-outline-primary:hover {
    background: #ffd700;
    color: #000000;
    border-color: #ffd700;
}

/* Rotate buttons - Blue/Info theme */
.dtf-tool-object-toolbar .btn-outline-info {
    border-color: #3b82f6;
    color: #ffffff;
    background: rgba(59, 130, 246, 0.2);
}

.dtf-tool-object-toolbar .btn-outline-info:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

/* Remove button - Red/Danger theme */
.dtf-tool-object-toolbar .btn-outline-danger {
    border-color: #ef4444;
    color: #ffffff;
    background: rgba(239, 68, 68, 0.2);
}

.dtf-tool-object-toolbar .btn-outline-danger:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}

/* DPI Quality Indicators - 3 VERTICAL ROWS */
.layer-item {
    padding: 0.5rem;
    background: #2a2a2a;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    border: 1px solid #3a3a3a;
    overflow: hidden;
    display: flex;
    gap: 0.5rem;
}

/* Content area: 3 vertical rows */
.layer-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0; /* Allow truncation */
}

/* ROW 1: Icon + Filename */
.layer-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}

.layer-row:hover {
    color: #ffd700;
}

.layer-row i {
    flex-shrink: 0;
    font-size: 0.85rem;
    color: #999999;
}

.layer-filename {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.85rem;
    font-weight: 500;
    color: #ffffff;
}

/* Buttons on the right side */
.layer-actions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-shrink: 0;
    align-self: flex-start;
}

.layer-actions .btn {
    padding: 0.25rem 0.35rem;
    font-size: 0.7rem;
    line-height: 1;
    min-width: 32px;
}

/* ROW 2: Dimensions (Width × Height) */
.dimensions-info {
    padding: 0;
    background: transparent;
    border-radius: 0;
    margin: 0;
}

.dimensions-info small {
    font-size: 0.75rem;
    display: block;
    color: #ffffff !important;
    font-weight: 600 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dimensions-info small strong {
    color: #ffd700 !important;
    font-weight: 700 !important;
}

.dimensions-info i {
    font-size: 0.7rem;
    margin-right: 0.25rem;
    color: #ffd700 !important;
}

/* ROW 3: DPI Quality Badge */
.dpi-badge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin: 0;
    width: fit-content;
    max-width: 100%;
}

.dpi-icon {
    font-size: 0.8rem;
    font-weight: bold;
    flex-shrink: 0;
}

.dpi-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Aspect Ratio Lock Button */
.btn.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.btn.btn-primary:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.btn.btn-outline-secondary {
    border-color: #6c757d;
    color: #6c757d;
}

.btn.btn-outline-secondary:hover {
    background-color: #6c757d;
    color: #ffffff;
}

/* SweetAlert2 Modal - Ensure it appears above editor overlay */
.swal2-container {
    z-index: 10000 !important;
}

.swal2-popup {
    z-index: 10001 !important;
}

/* DPI Warning Modal */
.dpi-warning-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.dpi-warning-list li {
    padding: 0.75rem;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    color: #856404;
}

.dpi-warning-list li.low-quality {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.dpi-warning-list li strong {
    font-weight: 700;
}
