/**
 * CSS Grid Generator Layout Styles
 * Custom layout implementation without Bootstrap dependencies
 */

/* Main container */
.css-grid-generator-wrapper {
    max-width: 100%;
    margin: 0 auto;
}

/* Two-column layout: main area (75%) and sidebar (25%) */
.grid-generator-layout {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
}

.grid-generator-main {
    flex: 1 1 65%;
    min-width: 0;
}

.grid-generator-sidebar {
    flex: 1 1 30%;
    max-width: 250px;
    border-left: 1px solid #e0e0e0;
    padding-left: 2rem;
}

/* Controls row */
.grid-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
}

.control-group .fs-sm {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.25rem;
}

/* Input groups */
.input-group {
    display: flex;
    align-items: stretch;
    gap: 1rem;
    height: 60px;
}

.input-group input[type="number"],
.input-group select {
    flex: 1;
}

.input-group button {
    background-color: #000;
    border-width: 0;
    color: #fff;
    font-family: inherit;
    font-size: 1.25rem;
    line-height: inherit;
    padding-top: 1rem;
    padding-right: 2.25rem;
    padding-bottom: 1rem;
    padding-left: 2.25rem;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
    border-radius: 30px;
    cursor: pointer;
    border-style: solid;
    border-width: 1px;
    margin: 0;
}

.input-group button:hover {
    background: #000;
}

.input-group button:active {
    background: #000;
}

.input-group input {
    padding: 0.5rem;
    border: 1px solid #ccc;
    text-align: center;
}

.input-group select {
    padding: 0.5rem;
    border: 1px solid #ccc;
    background: white;
    width: 50px;
}

/* Form controls */
.form-control,
.form-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 10px;
    font-size: 1.25rem;
}

.form-control-sm {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
}

.form-select:focus,
.form-control:focus {
    border-color: #000;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

/* Buttons */
.btn {
    background-color: #000;
    border-width: 0;
    color: #fff;
    font-family: inherit;
    font-size: 1.25rem;
    line-height: inherit;
    padding-top: 1rem;
    padding-right: 2.25rem;
    padding-bottom: 1rem;
    padding-left: 2.25rem;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
    border-radius: 30px;
    cursor: pointer;
    border-style: solid;
    border-width: 1px;
    margin: 0;
}

input:focus, select:focus {
    border-color: #000;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background-color: #000;
    color: white;
    border-color: #000;
}

.btn-primary:hover {
    background-color: #000;
    border-color: #000;
}

.btn-light {
    background-color: #f8f9fa;
    color: #212529;
    border-color: #dee2e6;
}

.btn-light:hover {
    background-color: #e2e6ea;
    border-color: #dae0e5;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    border-color: #6c757d;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
}

.d-grid {
    display: grid;
}

/* Sidebar navigation */
#navPage {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#navPage h4,
#navPage h5 {
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
}

#navPage h5 {
    font-size: 1rem;
    margin-top: 1rem;
}

.border-bottom {
    border-bottom: 1px solid #e0e0e0;
}

.pb-4 {
    padding-bottom: 1.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.my-2 {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Grid editing area */
#grids-page {
    width: 100%;
    height: 500px;
    display: flex;
    align-items: start;
    justify-content: center;
}

#grid-container {
    position: relative;
    margin: 0;
    padding: 5px;
    border-radius: 5px;
    background-color: #f5f5f5;
    width: 100%;
}

/* Row layout for sidebar controls */
.sidebar-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.sidebar-row > div {
    flex: 1;
}

.rowcol-value {
    max-width: 70px;
}

/* Code output section */
.code-output-section {
    margin-top: 2rem;
    width: 100%;
}

.code-block {
    margin-bottom: 1.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.code-block .header {
    background-color: #f8f9fa;
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-bottom: 1px solid #e0e0e0;
}

.code-block .code-toolbar {
    background-color: #f5f5f5;
}

.code-block pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
    background-color: #f5f5f5;
}

.code-block code {
	font-family: 'Monaco', 'Courier New', monospace;
	font-size: 1.25rem;
	line-height: 1.75;
	display: block;
	white-space: pre-wrap;
	word-wrap: break-word;
	color: #000 !important;
	min-height: 2em;
}

.code-block code * {
	color: inherit;
}

/* Ensure Prism token colors work */
.code-block .token.comment,
.code-block .token.prolog,
.code-block .token.doctype,
.code-block .token.cdata {
	color: slategray !important;
}

.code-block .token.punctuation {
	color: #999 !important;
}

.code-block .token.property,
.code-block .token.tag,
.code-block .token.boolean,
.code-block .token.number,
.code-block .token.constant,
.code-block .token.symbol,
.code-block .token.deleted {
	color: #905 !important;
}

.code-block .token.selector,
.code-block .token.attr-name,
.code-block .token.string,
.code-block .token.char,
.code-block .token.builtin,
.code-block .token.inserted {
	color: #690 !important;
}

.code-block .token.function {
	color: #DD4A68 !important;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    width: 100%;
    height: 100%;
    overflow: hidden;
    outline: 0;
}

.modal.fade {
    opacity: 0;
    transition: opacity 0.15s linear;
}

.modal.show {
    opacity: 1;
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem auto;
    max-width: 800px;
    pointer-events: none;
}

.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}

.modal-dialog-scrollable {
    max-height: calc(100% - 3.5rem);
}

.modal-dialog-scrollable .modal-body {
    overflow-y: auto;
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 0.3rem;
    outline: 0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.5;
}

.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem;
    border-top: 1px solid #dee2e6;
    gap: 0.5rem;
}

/* Modal backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    width: 100vw;
    height: 100vh;
    background-color: #000;
}

.modal-backdrop.fade {
    opacity: 0;
}

.modal-backdrop.show {
    opacity: 0.5;
}

/* Grid templates gallery */
.grid-templates-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.grid-templates figure {
    cursor: pointer;
    text-align: center;
    margin: 0;
    padding: 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    transition: all 0.2s;
}

.grid-templates figure:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.grid-templates figure img {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 0.5rem;
}

.grid-templates figcaption {
    font-size: 0.875rem;
    font-weight: 500;
}

.grid-templates h5 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Input group text */
.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    text-align: center;
    white-space: nowrap;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .grid-generator-layout {
        flex-direction: column;
    }
    
    .grid-generator-sidebar {
        border-left: none;
        border-top: 1px solid #e0e0e0;
        padding-left: 0;
        padding-top: 2rem;
    }
    
    .grid-controls {
        grid-template-columns: 1fr;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .grid-templates-gallery {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

/* Utility classes */
.hide {
    display: none !important;
}

.fs-sm {
    font-size: 0.8em;
}

.border-start {
    border-left: 1px solid #e0e0e0;
}

