/* Custom CSS Styles for Industrial Motor Selection Tool - DKM Motor Branding */

:root {
    /* DKM Brand Colors */
    --dkm-blue-dark: #1e3a8a;
    --dkm-blue: #1e40af;
    --dkm-blue-light: #3b82f6;
    --dkm-blue-lighter: #60a5fa;
    --dkm-blue-pale: #dbeafe;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
}

/* Utilities */
.rotate-180 {
    transform: rotate(180deg);
}

.cursor-pointer {
    cursor: pointer;
}

/* Card Styles */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.1);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(30, 64, 175, 0.2);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 2px solid #e5e7eb;
}

/* Load Type Card */
.load-type-card {
    position: relative !important;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%) !important;
    border: 3px solid #e5e7eb !important;
    border-radius: 16px !important;
    padding: 1.5rem !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: block !important;
    min-height: 380px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}

.load-type-card:hover {
    border-color: #3b82f6 !important;
    transform: translateY(-6px) !important;
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.3) !important;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%) !important;
}

.load-type-card.selected {
    border-color: #1e40af !important;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%) !important;
    box-shadow: 0 8px 20px rgba(30, 64, 175, 0.4) !important;
    transform: scale(1.02) !important;
}

.load-type-card.selected::before {
    content: '✓';
    position: absolute;
    top: 12px;
    right: 12px;
    background: #1e40af;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(30, 64, 175, 0.3);
}

/* Button Styles */
.btn-primary {
    background: linear-gradient(135deg, var(--dkm-blue) 0%, var(--dkm-blue-dark) 100%) !important;
    color: white !important;
    padding: 0.75rem 1.5rem !important;
    border-radius: 8px !important;
    border: none !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    font-size: 1rem !important;
    text-align: center !important;
    box-shadow: 0 4px 6px rgba(30, 64, 175, 0.2) !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--dkm-blue-light) 0%, var(--dkm-blue) 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 12px rgba(30, 64, 175, 0.3) !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--dkm-blue-light) 0%, var(--dkm-blue) 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 12px rgba(30, 64, 175, 0.3) !important;
}

.btn-primary:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 4px rgba(30, 64, 175, 0.2) !important;
}

.btn-secondary {
    background: #6b7280 !important;
    color: white !important;
    padding: 0.75rem 1.5rem !important;
    border-radius: 8px !important;
    border: none !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1rem !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.btn-secondary:hover {
    background: #4b5563 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
}

.btn-secondary:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.btn-secondary:hover {
    background: #4b5563 !important;
}

.btn-outline {
    background: transparent;
    color: #3b82f6;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: 2px solid #3b82f6;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background: #3b82f6;
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

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

.btn-sm {
    background: linear-gradient(135deg, var(--dkm-blue-light) 0%, var(--dkm-blue) 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.btn-sm:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

/* Step Indicator */
.step-indicator {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.step-indicator.active {
    background: linear-gradient(135deg, var(--dkm-blue-light) 0%, var(--dkm-blue) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.4);
}

.step-indicator.completed {
    background: #10b981;
    color: white;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-help {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Result Card */
.result-card {
    background: white;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.result-card-success {
    border-color: #10b981;
    background: #f0fdf4;
}

.result-card-warning {
    border-color: #f59e0b;
    background: #fffbeb;
}

.result-card-error {
    border-color: #ef4444;
    background: #fef2f2;
}

/* Motor Card */
.motor-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.motor-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.motor-card.recommended {
    border-color: #10b981;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.motor-card .badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Table Styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.data-table th {
    background: #f9fafb;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}

.data-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.data-table tr:hover {
    background: #f9fafb;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 400px;
    margin: 2rem 0;
}

/* Grid Layout */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.info-item {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
}

.info-item-label {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.info-item-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
}

.info-item-unit {
    font-size: 0.9rem;
    color: #6b7280;
    margin-left: 0.25rem;
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-success {
    color: #10b981;
}

.text-warning {
    color: #f59e0b;
}

.text-error {
    color: #ef4444;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .card-header {
        padding: 1rem;
    }

    .load-type-card {
        padding: 1.5rem;
        min-height: 320px;
    }
    
    .load-type-card h3 {
        font-size: 1.125rem;
    }
    
    .load-type-card svg {
        height: 100px !important;
    }
    
    .load-type-card .btn-primary {
        font-size: 0.875rem;
        padding: 0.625rem 1rem !important;
    }

    .chart-container {
        height: 300px;
    }

    .step-indicator {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    /* 헤더 최적화 */
    header img {
        height: 36px !important;
    }
    
    header h1 {
        font-size: 1rem;
    }
    
    header p {
        font-size: 0.75rem;
    }
    
    /* 카드 그리드 1열로 */
    .grid.md\\:grid-cols-3 {
        grid-template-columns: 1fr;
    }
    
    .grid.md\\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

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

/* Toast Animation */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Alert Box */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-info {
    background: #dbeafe;
    border: 1px solid #3b82f6;
    color: #1e40af;
}

.alert-success {
    background: #d1fae5;
    border: 1px solid #10b981;
    color: #065f46;
}

.alert-warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
}

.alert-error {
    background: #fee2e2;
    border: 1px solid #ef4444;
    color: #991b1b;
}

/* PDF Export Styles */
.pdf-section {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 20px;
}

#pdf-content {
    width: 100%;
    max-width: 100%;
}

#pdf-content .card {
    page-break-inside: avoid;
    break-inside: avoid;
}

#pdf-content svg {
    max-width: 100%;
    height: auto;
    display: block;
    background: transparent;
}

/* SVG 내부 요소들이 올바르게 렌더링되도록 */
#pdf-content svg text {
    font-family: 'Noto Sans KR', sans-serif;
}

#pdf-content svg rect,
#pdf-content svg circle,
#pdf-content svg path,
#pdf-content svg line {
    shape-rendering: geometricPrecision;
}

/* Prevent chart from breaking across pages */
#pdf-content .chart-container {
    page-break-inside: avoid;
    break-inside: avoid;
    position: relative;
    min-height: 400px;
}

#pdf-content .chart-container canvas {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
}

/* Motor candidate cards */
#pdf-content .motor-card {
    page-break-inside: avoid;
    break-inside: avoid;
}
