/* Universal Logic Grid Tool CSS
 * Location: assets/logic-grid-universal.css
 * Handles all logic grid sizes dynamically
 */

/* Hidden class for toggling visibility */
.hidden {
    display: none;
}

body {
    background: #000;
    color: #0f0;
    font-family: 'Courier New', monospace;
    margin: 0;
    padding: 20px;
    overflow-x: hidden;
}

/* Digital Rain Canvas */
#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 0;
    opacity: 0.15;
}

/* Main Container */
.grid-container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #0f0;
    padding: 30px;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
}

/* Header */
.grid-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #0f0;
    padding-bottom: 20px;
}

.grid-header h1 {
    font-size: 2.5em;
    margin: 0 0 10px 0;
    text-shadow: 0 0 10px #0f0;
    animation: glow 2s ease-in-out infinite alternate;
}

.grid-header .subtitle {
    font-size: 1.2em;
    color: #0d0;
    opacity: 0.8;
}

/* Console */
#console {
    background: rgba(0, 20, 0, 0.9);
    border: 1px solid #0f0;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 0.9em;
    max-height: 150px;
    overflow-y: auto;
    box-shadow: inset 0 0 10px rgba(0, 255, 0, 0.2);
}

#console-output div {
    margin: 3px 0;
    animation: fadeIn 0.3s;
}

/* URL Builder Section */
.url-builder {
    background: rgba(0, 40, 0, 0.6);
    border: 1px solid #0f0;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 5px;
}

.url-builder h3 {
    margin-top: 0;
    color: #0f0;
    text-shadow: 0 0 5px #0f0;
}

.builder-inputs {
    display: grid;
    gap: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    margin-bottom: 5px;
    font-size: 0.9em;
    color: #0d0;
}

.input-group input,
.input-group textarea {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #0f0;
    color: #0f0;
    padding: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.input-group textarea {
    resize: vertical;
    min-height: 60px;
}

.builder-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Buttons */
.btn {
    background: rgba(0, 100, 0, 0.8);
    border: 1px solid #0f0;
    color: #0f0;
    padding: 10px 20px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    transition: all 0.3s;
    text-transform: uppercase;
}

.btn:hover {
    background: rgba(0, 150, 0, 0.9);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(0, 60, 0, 0.6);
}

/* Clues Section */
.clues-section {
    background: rgba(0, 30, 0, 0.7);
    border: 1px solid #0f0;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 5px;
}

.clues-section h3 {
    margin-top: 0;
    color: #0f0;
    text-shadow: 0 0 5px #0f0;
}

.clue-item {
    padding: 8px 12px;
    margin: 5px 0;
    background: rgba(0, 0, 0, 0.5);
    border-left: 3px solid #0f0;
}

/* Logic Grid Table */
.grid-wrapper {
    overflow-x: auto;
    margin-bottom: 20px;
}

.logic-grid {
    border-collapse: collapse;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.9);
}

.logic-grid th {
    background: rgba(0, 80, 0, 0.8);
    color: #0f0;
    padding: 12px;
    border: 1px solid #0f0;
    font-weight: bold;
    text-align: center;
    min-width: 100px;
}

.logic-grid td {
    width: 80px;
    height: 80px;
    border: 1px solid #0f0;
    text-align: center;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.8);
    transition: all 0.2s;
    position: relative;
}

.logic-grid td:hover {
    background: rgba(0, 100, 0, 0.3);
    transform: scale(1.05);
}

/* Cell States */
.logic-grid td.empty {
    background: rgba(0, 0, 0, 0.8);
}

.logic-grid td.check::before {
    content: '✓';
    font-size: 2.5em;
    color: #0f0;
    text-shadow: 0 0 10px #0f0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: popIn 0.3s;
}

.logic-grid td.cross::before {
    content: '✗';
    font-size: 2.5em;
    color: #f00;
    text-shadow: 0 0 10px #f00;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: popIn 0.3s;
}

/* Action Buttons */
.action-buttons {
    text-align: center;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Instructions */
.instructions {
    background: rgba(0, 30, 0, 0.7);
    border: 1px solid #0f0;
    padding: 15px;
    margin-top: 20px;
    border-radius: 5px;
    font-size: 0.9em;
}

.instructions h4 {
    margin-top: 0;
    color: #0f0;
}

.instructions ul {
    margin: 10px 0;
    padding-left: 20px;
}

/* Share Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
}

.modal:not(.hidden) {
    display: block;
}

.modal-content {
    background: rgba(0, 20, 0, 0.95);
    margin: 10% auto;
    padding: 30px;
    border: 2px solid #0f0;
    width: 80%;
    max-width: 600px;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.5);
}

.modal-content h3 {
    margin-top: 0;
    color: #0f0;
    text-shadow: 0 0 10px #0f0;
}

.modal-content input {
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #0f0;
    color: #0f0;
    padding: 10px;
    font-family: 'Courier New', monospace;
    margin: 15px 0;
}

.close {
    color: #0f0;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #f00;
    text-shadow: 0 0 10px #f00;
}

/* Animations */
@keyframes glow {
    from { text-shadow: 0 0 10px #0f0, 0 0 20px #0f0; }
    to { text-shadow: 0 0 20px #0f0, 0 0 30px #0f0, 0 0 40px #0f0; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
    0% { transform: translate(-50%, -50%) scale(0); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes glitch {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
}

.glitch {
    animation: glitch 0.3s;
}

/* Responsive Design */
@media (max-width: 768px) {
    .grid-container {
        padding: 15px;
    }
    
    .grid-header h1 {
        font-size: 1.8em;
    }
    
    .logic-grid th,
    .logic-grid td {
        min-width: 60px;
        width: 60px;
        height: 60px;
        padding: 5px;
        font-size: 0.8em;
    }
    
    .logic-grid td.check::before,
    .logic-grid td.cross::before {
        font-size: 1.8em;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}