/* Index Page Styles - Matrix Portal Landing Page */
/* MOBILE FIXED: Proper z-index layering and touch events */

/* Portal Container */
.portal-container {
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #0f0;
    border-radius: 10px;
    padding: 40px;
    margin: 20px auto;
    min-width: 400px;
    max-width: 800px;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.3);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 100; /* Increased to ensure it's above Matrix canvas */
}

.portal-title {
    text-align: center;
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 0 0 10px #0f0;
    color: #0f0;
}

.portal-subtitle {
    text-align: center;
    color: #888;
    margin-bottom: 30px;
    font-size: 1.1em;
}

/* Welcome Section */
.welcome-section {
    background: #111;
    border: 1px solid #333;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.section-title {
    color: #0f0;
    font-size: 1.5em;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.welcome-section p {
    color: #ccc;
    line-height: 1.6;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

.feature-card {
    background: rgba(0, 255, 0, 0.05);
    border: 1px solid #0f0;
    border-radius: 5px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s;
    position: relative;
    z-index: 1;
    cursor: pointer;
    touch-action: manipulation; /* Improves mobile tap response */
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 255, 0, 0.3);
    background: rgba(0, 255, 0, 0.1);
}

.feature-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

.feature-card h3 {
    color: #0f0;
    font-size: 1em;
    margin-bottom: 8px;
    font-weight: bold;
}

.feature-card p {
    color: #999;
    font-size: 0.85em;
    line-height: 1.4;
}

/* Tools Card - CRITICAL FOR MOBILE CLICKABILITY */
.tools-card {
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.1), rgba(0, 255, 0, 0.05));
    border: 2px solid #0f0;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    z-index: 10; /* Ensures it's above most other elements */
}

.tools-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #0f0, transparent);
    animation: scan 2s linear infinite;
    z-index: -1; /* Behind content */
}

@keyframes scan {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.tools-card-title {
    color: #0f0;
    font-size: 1.8em;
    margin-bottom: 20px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 3px;
    position: relative;
    z-index: 1;
}

.tools-card-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

.tools-card-content > p {
    color: #ccc;
    margin-bottom: 15px;
}

.tools-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    text-align: left;
}

.tools-list li {
    color: #0f0;
    font-size: 0.9em;
    padding: 5px 10px;
    background: rgba(0, 255, 0, 0.05);
    border-left: 2px solid #0f0;
    transition: all 0.3s;
}

.tools-list li:hover {
    background: rgba(0, 255, 0, 0.1);
    transform: translateX(5px);
}

/* Tools Button - CRITICAL FOR MOBILE CLICKS */
.tools-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #0f0;
    color: #000;
    padding: 15px 30px;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1em;
    transition: all 0.3s;
    margin: 15px 0;
    cursor: pointer;
    position: relative;
    z-index: 20; /* High z-index for clickability */
    touch-action: manipulation; /* Better mobile tap response */
    -webkit-tap-highlight-color: rgba(0, 255, 0, 0.3); /* Visual feedback on mobile */
    min-height: 44px; /* iOS recommended minimum tap target */
}

.tools-btn:hover,
.tools-btn:active {
    background: #0c0;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
    transform: scale(1.05);
}

.btn-text {
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-icon {
    font-size: 1.2em;
    transition: transform 0.3s;
}

.tools-btn:hover .btn-icon {
    transform: translateX(5px);
}

.tools-note {
    color: #888;
    font-size: 0.85em;
    margin-top: 10px;
    font-style: italic;
}

/* Authentication Section */
.auth-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #333;
    position: relative;
    z-index: 1;
}

/* Mode Toggle Buttons */
.mode-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    gap: 5px;
}

.mode-btn {
    background: #111;
    border: 2px solid #333;
    color: #0f0;
    padding: 10px 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9em;
    transition: all 0.3s;
    border-radius: 0;
    position: relative;
    z-index: 1;
    touch-action: manipulation;
    min-height: 44px; /* iOS tap target */
}

.mode-btn:hover,
.mode-btn:active {
    border-color: #0f0;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.mode-btn.active {
    background: #0f0;
    color: #000;
    border-color: #0f0;
}

/* Forms */
.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #0f0;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 12px;
    background: #111;
    border: 2px solid #333;
    color: #0f0;
    font-family: inherit;
    font-size: 1em;
    border-radius: 5px;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

.form-group input:focus {
    border-color: #0f0;
    outline: none;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.submit-btn {
    width: 100%;
    padding: 15px;
    background: #0f0;
    border: none;
    color: #000;
    font-family: inherit;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
    text-transform: uppercase;
    position: relative;
    z-index: 1;
    touch-action: manipulation;
    min-height: 44px;
}

.submit-btn:hover,
.submit-btn:active {
    background: #0c0;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
    transform: translateY(-2px);
}

/* Messages */
.error-message {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid #f00;
    color: #f00;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    text-align: center;
}

.success-message {
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid #0f0;
    color: #0f0;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    text-align: center;
}

.guest-warning {
    background: rgba(255, 165, 0, 0.1);
    border: 1px solid #ffa500;
    color: #ffa500;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 5px;
    font-size: 0.9em;
    text-align: center;
}

/* Password Requirements */
.password-requirements {
    font-size: 0.8em;
    color: #888;
    margin-top: 5px;
    list-style: none;
    padding: 0;
}

.password-requirements li {
    margin: 3px 0;
}

.password-requirements li:before {
    content: "• ";
    color: #0f0;
}

/* System Info */
.system-info {
    background: #111;
    border: 1px solid #333;
    border-radius: 5px;
    padding: 20px;
    margin-top: 30px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.system-info h3 {
    color: #0f0;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.8em;
    color: #0f0;
    font-weight: bold;
    margin-bottom: 5px;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.stat-label {
    font-size: 0.85em;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .portal-container {
        margin: 10px;
        min-width: auto;
        width: calc(100% - 20px);
        padding: 25px 15px;
        z-index: 100; /* Maintain high z-index on mobile */
    }
    
    .portal-title {
        font-size: 2em;
    }
    
    .features-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .tools-list {
        grid-template-columns: 1fr;
    }
    
    .tools-btn {
        width: 100%;
        padding: 18px 20px; /* Larger tap target */
        font-size: 1em;
    }
    
    .mode-toggle {
        flex-direction: column;
        gap: 10px;
    }
    
    .mode-btn {
        width: 100%;
        padding: 14px 20px; /* Larger tap target */
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .portal-container {
        margin: 5px;
        width: calc(100% - 10px);
        padding: 20px 10px;
    }
    
    .portal-title {
        font-size: 1.8em;
    }
    
    .section-title {
        font-size: 1.2em;
    }
    
    .tools-card-title {
        font-size: 1.3em;
    }
    
    .tools-card {
        padding: 20px 15px;
    }
    
    .tools-btn {
        padding: 16px;
        font-size: 0.95em;
    }
}

/* Glitch effect for tools card title */
.tools-card-title.glitch {
    position: relative;
}

.tools-card-title.glitch::before,
.tools-card-title.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Behind main text */
}

.tools-card-title.glitch::before {
    animation: glitch1 0.5s infinite;
    color: #0ff;
}

.tools-card-title.glitch::after {
    animation: glitch2 0.5s infinite;
    color: #f0f;
}

@keyframes glitch1 {
    0% { clip-path: polygon(0 2%, 100% 2%, 100% 5%, 0 5%); }
    20% { clip-path: polygon(0 15%, 100% 15%, 100% 25%, 0 25%); }
    40% { clip-path: polygon(0 40%, 100% 40%, 100% 45%, 0 45%); }
    60% { clip-path: polygon(0 60%, 100% 60%, 100% 70%, 0 70%); }
    80% { clip-path: polygon(0 80%, 100% 80%, 100% 90%, 0 90%); }
    100% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
}

@keyframes glitch2 {
    0% { clip-path: polygon(0 10%, 100% 10%, 100% 20%, 0 20%); transform: translate(-2px); }
    25% { clip-path: polygon(0 30%, 100% 30%, 100% 40%, 0 40%); transform: translate(2px); }
    50% { clip-path: polygon(0 50%, 100% 50%, 100% 60%, 0 60%); transform: translate(-1px); }
    75% { clip-path: polygon(0 70%, 100% 70%, 100% 80%, 0 80%); transform: translate(1px); }
    100% { clip-path: polygon(0 90%, 100% 90%, 100% 100%, 0 100%); transform: translate(0); }
}

/* Ensure pointer events work on all interactive elements */
a, button, input, select, textarea, .mode-btn, .tools-btn, .submit-btn {
    cursor: pointer;
    pointer-events: auto;
}