/* static/style.css */

:root {
    /* Color Palette (Blueprint Theme) */
    --bg-color: #0A192F;          /* Dark navy blue background */
    --grid-color: rgba(0, 123, 255, 0.1); /* Subtle electric blue grid */
    --primary-color: #007BFF;     /* Electric blue for accents */
    --secondary-color: #64FFDA;   /* Cyan for secondary highlights */
    --text-color: #E0E0E0;        /* Light gray for general text */
    --card-bg: #1A2E47;           /* Slightly lighter dark blue for cards/panels */
    --border-color: #004D99;      /* Darker blue for borders */
    --danger-color: #dc3545;      /* Red for dangerous actions */
    --success-color: #28a745;     /* Green for success actions */

    /* Typography */
    --font-family-primary: 'Fira Code', 'Source Code Pro', monospace;
    --font-family-secondary: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-family-primary);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column; /* For sticky footer */
}

/* Graph Paper Background Effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Behind other content */
    background-image:
        linear-gradient(to right, var(--grid-color) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px);
    background-size: 20px 20px; /* Adjust grid cell size */
    opacity: 0.6;
}


.container {
    max-width: 1400px; /* Max width for larger screens */
    margin: 0 auto;
    padding: 20px;
    flex-grow: 1; /* Allows content to expand */
    display: flex;
    flex-direction: column;
}

/* Header Styling */
/* with logo */
.header {
    display: flex; /* Use flexbox for alignment */
    flex-direction: column; /* Stack items vertically by default */
    align-items: center; /* Center horizontally */
    text-align: center; /* Center text */
    padding: 20px 0;
    margin-bottom: 20px;
    position: relative; /* For absolute positioning if needed */
}

.header h1 {
    font-size: 2.8em;
    color: var(--primary-color);
    margin-bottom: 5px;
    text-shadow: 0 0 10px rgba(0, 123, 255, 0.5); /* Subtle glow */
}

.header p {
    font-size: 1.1em;
    color: var(--secondary-color);
}


/* Logo */

/* Style for the logo image */
.site-logo {
    width: 80px;  /* Adjust size as needed */
    height: auto;
    margin-bottom: 10px; /* Space between logo and title */
    vertical-align: middle; /* Align with text if on same line */
}


/* Main Content Layout (Flexbox for responsiveness) */
.main-content {
    display: flex;
    flex-wrap: wrap; /* Allows panels to wrap on smaller screens */
    gap: 20px;
    flex-grow: 1;
}

.control-panel,
.info-panel {
    flex: 1; /* Allows panels to grow and shrink */
    min-width: 300px; /* Minimum width before wrapping */
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.visualization-area {
    flex: 2; /* Main visualization area takes more space */
    min-width: 500px; /* Ensure it has enough space */
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex; /* To center the graph-container */
    align-items: center;
    justify-content: center;
}

/* Graph Container */
#graph-container {
    width: 100%;
    height: 600px; /* Fixed height for now, will adjust with JS later */
    background-color: var(--bg-color); /* Inner graph background */
    border-radius: 5px;
    overflow: hidden; /* Ensure graph doesn't spill out */
}

/* Headings within panels */
.control-panel h2,
.info-panel h2 {
    color: var(--primary-color);
    font-size: 1.5em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.control-panel h3 {
    color: var(--secondary-color);
    font-size: 1.2em;
    margin-top: 20px;
    margin-bottom: 10px;
}

/* Form Group Styling */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.form-group-inline input[type="text"],
.form-group-inline input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: #283F5E; /* Slightly lighter input background */
    color: var(--text-color);
    font-family: var(--font-family-secondary);
    font-size: 1em;
}

.form-group input::placeholder,
.form-group-inline input::placeholder{
    color: rgba(224, 224, 224, 0.5);
}

.form-group-inline {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.form-group-inline input {
    width: 100%; /* They will share the space */
}

/* Button Styling */
.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: var(--font-family-primary);
    font-size: 1em;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-right: 10px; /* Spacing between buttons */
    margin-bottom: 10px; /* Spacing for wrapping */
}


.btn:last-child {
    margin-right: 0;
}

.btn.primary {
    background-color: var(--primary-color);
    color: var(--bg-color);
}

.btn.primary:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.btn.secondary {
    background-color: var(--secondary-color);
    color: var(--bg-color);
}

.btn.secondary:hover {
    background-color: #4CAF8D;
    transform: translateY(-2px);
}

.btn.danger {
    background-color: var(--danger-color);
    color: white;
}

.btn.danger:hover {
    background-color: #c82333;
    transform: translateY(-2px);
}

.btn.success {
    background-color: var(--success-color);
    color: white;
}

.btn.success:hover {
    background-color: #218838;
    transform: translateY(-2px);
}

.btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
}

.algorithm-actions {
    display: flex;
    flex-wrap: wrap; /* Allow buttons to wrap */
    gap: 10px;
    margin-top: 25px; 
}

.form-group button {
    margin-top: 15px;
}


.node-edge-forms {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.node-edge-forms h3 {
    color: var(--secondary-color);
    margin-bottom: 10px;
}

/* Explanation and State Display */
.card {
    background-color: var(--bg-color); /* Darker background for code/explanation */
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 15px;
    overflow-x: auto; /* For code blocks */
}

.card p, .card pre {
    color: var(--text-color);
    font-size: 0.95em;
}

.card pre {
    white-space: pre-wrap; /* Preserve whitespace and wrap long lines */
    word-wrap: break-word;
}

/* Hidden utility class */
.hidden {
    display: none !important;
}

/* Footer Styling */
.footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--secondary-color);
    font-size: 0.9em;
}

/* Toast Notification System */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    padding: 15px 20px;
    margin-bottom: 10px; /* Space between toasts if ever needed */
    border-radius: 5px;
    background-color: var(--card-bg);
    color: var(--text-color);
    /* MODIFIED: Increased shadow for better pop */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.6); 
    font-family: var(--font-family-secondary);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

/* Different toast types */
.toast.error::before {
    content: '⚠️ '; /* Warning icon */
    font-family: sans-serif;
}

.toast.error {
    border: 1px solid var(--secondary-color); /* Cyan border */
    color: var(--secondary-color); /* Cyan text */
}
.toast.success {
    border-left: 5px solid var(--success-color);
}

/* custom modal for node entry */
/* Add this to the end of your style.css */

#custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

#custom-modal {
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid var(--primary-color);
    box-shadow: 0 5px 25px rgba(0, 123, 255, 0.4);
    width: 90%;
    max-width: 400px;
    text-align: center;
}

#custom-modal h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

#custom-modal p {
    color: var(--text-color);
    margin-bottom: 20px;
}

#modal-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: #283F5E;
    color: var(--text-color);
    font-size: 1.1em;
    text-align: center;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}


/* Responsive Adjustments */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column; /* Stack panels vertically on smaller screens */
        align-items: center; /* Center items when stacked */
    }

    .control-panel,
    .info-panel,
    .visualization-area {
        flex: none; /* Remove flex growing behavior */
        width: 100%; /* Take full width */
        max-width: 700px; /* Optional: cap max width for readability */
    }

    #graph-container {
        height: 400px; /* Adjust height for smaller screens */
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2em;
    }

    .header p {
        font-size: 0.9em;
    }

    .control-panel,
    .info-panel {
        padding: 15px;
    }

    .btn {
        width: 100%; /* Full width buttons on very small screens */
        margin-right: 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
}
