/* Custom Styles and Animations */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow-x: hidden;
}

/* Smooth Transitions */
.transition-all {
    transition: all 0.3s ease;
}

/* Mode Button Styles */
.mode-btn {
    position: relative;
    overflow: hidden;
}

.mode-btn.active-mode {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.mode-btn:not(.active-mode) {
    opacity: 0.7;
}

.mode-btn:hover {
    transform: translateY(-2px);
}

/* Package Button Styles */
.package-btn {
    position: relative;
    transition: all 0.3s ease;
}

.package-btn.active-package {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.package-btn:not(.active-package) {
    opacity: 0.7;
}

.package-btn:hover {
    transform: translateY(-2px);
}

.package-btn.active-package[data-package="basic"] {
    border-color: rgb(5, 150, 105) !important;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.package-btn.active-package[data-package="advanced"] {
    border-color: rgb(79, 70, 229) !important;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.package-btn.active-package[data-package="custom"] {
    border-color: rgb(147, 51, 234) !important;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
}

/* Custom Tool Checkbox Styles */
.custom-tool-checkbox {
    width: 18px;
    height: 18px;
    accent-color: rgb(168, 85, 247);
    cursor: pointer;
}

/* Tool List Display Styles */
#tool-list-display {
    animation: fadeIn 0.3s ease-out;
}

#tool-list-display .space-y-3 > div {
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
}

#tool-list-display .space-y-3 > div:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

/* Slide-in Animation for Drawer */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.drawer-open {
    animation: slideInFromRight 0.5s ease-out;
}

/* Tool Item Styles */
.tool-item {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.4), rgba(15, 23, 42, 0.6));
    border: 1px solid rgba(71, 85, 105, 0.3);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.tool-item:hover {
    border-color: rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.6), rgba(15, 23, 42, 0.8));
    transform: translateX(-4px);
}

.tool-item.active {
    border-color: rgba(16, 185, 129, 0.6);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

/* Tool Card Styles - New Design */
.tool-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.3), rgba(15, 23, 42, 0.5));
    border: 2px solid rgba(71, 85, 105, 0.3);
    border-radius: 16px;
    padding: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.5), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tool-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.7));
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.tool-card:hover::before {
    opacity: 1;
}

.tool-card.selected {
    border-color: rgba(16, 185, 129, 0.6);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(15, 23, 42, 0.7));
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.2);
}

.tool-card.selected::before {
    background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 1), transparent);
    opacity: 1;
}

.tool-card.running {
    border-color: rgba(234, 179, 8, 0.6);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.tool-card.completed {
    border-color: rgba(16, 185, 129, 0.4);
    opacity: 0.8;
}

.tool-card-header {
    display: flex;
    flex-direction: column;
}

.tool-select-btn {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(79, 70, 229, 0.3));
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: #a5b4fc;
    font-weight: 600;
    transition: all 0.2s ease;
}

.tool-select-btn:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(79, 70, 229, 0.4));
    border-color: rgba(99, 102, 241, 0.6);
    color: #c7d2fe;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.tool-card.selected .tool-select-btn {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.3));
    border-color: rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
}

/* Terminal Output Card */
.terminal-output-card {
    margin-top: 12px;
    background-color: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
    animation: fadeIn 0.3s ease-out;
}

/* Status Badge Styles */
.status-idle {
    background-color: rgba(71, 85, 105, 0.3);
    color: #94a3b8;
}

.status-recommending {
    background-color: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.status-running {
    background-color: rgba(234, 179, 8, 0.2);
    color: #fde047;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.status-completed {
    background-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.status-error {
    background-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* Terminal Output Styles */
.terminal-output {
    background-color: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.6;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, margin-top 0.4s ease;
    margin-top: 0;
}

.terminal-output.expanded {
    max-height: 300px;
    margin-top: 12px;
    overflow-y: auto;
}

.terminal-output::-webkit-scrollbar {
    width: 6px;
}

.terminal-output::-webkit-scrollbar-track {
    background: #1e293b;
    border-radius: 3px;
}

.terminal-output::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 3px;
}

.terminal-output::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.terminal-line {
    margin-bottom: 4px;
    animation: terminalLine 0.3s ease-out;
}

@keyframes terminalLine {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.terminal-success {
    color: #6ee7b7;
}

.terminal-error {
    color: #fca5a5;
}

.terminal-warning {
    color: #fde047;
}

.terminal-info {
    color: #a5b4fc;
}

.terminal-output-text {
    color: #cbd5e1;
}

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: .7;
    }
}

/* Expand/Collapse Icon Rotation */
.expand-icon {
    transition: transform 0.3s ease;
}

.expand-icon.expanded {
    transform: rotate(90deg);
}

/* Phase Progress Animations */
.phase-item.active .phase-status {
    background-color: rgba(234, 179, 8, 0.2);
    color: #fde047;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.phase-item.completed .phase-status {
    background-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

/* Gradient Text Animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.bg-gradient-to-r {
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

/* Button Press Effect */
button:active {
    transform: scale(0.98);
}

/* Loading Spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.fa-spinner {
    animation: spin 1s linear infinite;
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Custom Scrollbar for Drawer */
#side-drawer::-webkit-scrollbar,
.terminal-output-card::-webkit-scrollbar {
    width: 6px;
}

#side-drawer::-webkit-scrollbar-track,
.terminal-output-card::-webkit-scrollbar-track {
    background: #0f172a;
}

#side-drawer::-webkit-scrollbar-thumb,
.terminal-output-card::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

#side-drawer::-webkit-scrollbar-thumb:hover,
.terminal-output-card::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Hover Effects for Interactive Elements */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* AI Decision Banner Animation */
@keyframes bannerSlide {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#ai-decision-banner:not(.hidden) {
    animation: bannerSlide 0.4s ease-out;
}

/* AI Reasoning Box Animation */
#ai-reasoning-box:not(.hidden) {
    animation: bannerSlide 0.4s ease-out;
}

#ai-reasoning-box {
    background: linear-gradient(135deg, rgba(88, 28, 135, 0.1), rgba(49, 46, 129, 0.1));
}

/* Glow Effect for Active Elements */
.glow {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.glow-indigo {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

/* Report Modal Animations */
#report-modal {
    animation: fadeIn 0.3s ease-out;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
