/* =====================================================
   PROJECTS.CSS
   Styles for Projects Display, Grid, and Forms
   ===================================================== */

/* =====================================================
   1. BASE & CONTAINERS (Overflow Lock)
   ===================================================== */
#projects-page {
    color: #fff;
    width: 100%;
    overflow-x: hidden; /* Stops horizontal scrolling */
    position: relative;
    min-height: 100vh;
}

/* FLOW BACKGROUND */
.flow {
    position: fixed; /* Changed to fixed so it covers the whole screen while scrolling */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background:
        radial-gradient(circle at 60% 40%, rgba(156, 255, 0, .4), transparent 45%),
        radial-gradient(circle at 75% 70%, rgba(156, 255, 0, .2), transparent 50%);
    filter: blur(60px);
    z-index: 0;
    pointer-events: none;
}

/* =====================================================
   2. PAGE HEADER (Hero Section)
   ===================================================== */
.projects-hero {
    padding: 160px 8% 60px;
    text-align: center;
    position: relative;
    z-index: 2;
}

.projects-hero h1 {
    font-family: 'Anton', sans-serif;
    font-size: 72px;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 15px;
    line-height: 1.1;
}

.projects-hero h1 span {
    color: var(--green);
    -webkit-text-stroke: 1px transparent; /* Ensures solid color */
}

.projects-hero p {
    font-size: 18px;
    opacity: 0.85;
    max-width: 600px;
    margin: 0 auto;
}

/* =====================================================
   3. PROJECTS MAIN SECTION & GRID
   ===================================================== */
.projects-section {
    padding: 40px 8% 100px;
    position: relative;
    z-index: 2;
}

.projects-section > .btn-outline {
    display: inline-block;
    margin-bottom: 40px; /* Space between 'Add Project' button and grid */
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 40px;
    width: 100%;
}

/* =====================================================
   4. PROJECT CARD STYLING
   ===================================================== */
.project-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(156, 255, 0, 0.15);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(12px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 30px rgba(156, 255, 0, 0.15);
    border-color: rgba(156, 255, 0, 0.4);
}

.project-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 20px;
    background: rgba(0,0,0,0.5); /* Placeholder background if image is missing */
}

.project-card h3 {
    font-size: 22px;
    color: #fff;
    margin-bottom: 10px;
    line-height: 1.3;
}

.project-card .tag {
    display: inline-block;
    background: rgba(156, 255, 0, 0.1);
    color: var(--green);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    align-self: flex-start;
}

.project-card .description {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin-bottom: 24px;
    flex-grow: 1; /* Pushes actions to the bottom if text is short */
    
    /* Truncate text to 3 lines if it gets too long */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ACTIONS (Edit/Delete Buttons inside Card) */
.project-card .actions {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
}

.project-card .actions form {
    margin: 0; /* Override default form margins */
}

.edit-btn {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s ease;
}

.edit-btn:hover {
    color: var(--green);
}

.delete-btn {
    background: none;
    border: none;
    color: #ff4d4d;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    padding: 0;
    transition: color 0.2s ease;
}

.delete-btn:hover {
    color: #ff1a1a;
}

/* =====================================================
   5. PROJECT FORM STYLING (Create/Edit Pages)
   ===================================================== */
.project-form-page {
    padding: 160px 8%;
    max-width: 700px;
    margin: auto;
    position: relative;
    z-index: 2;
}

.project-form {
    background: rgba(255, 255, 255, .04);
    padding: 40px;
    border-radius: 20px;
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.project-form input,
.project-form textarea {
    width: 100%;
    margin-bottom: 18px;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .06);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.project-form textarea {
    min-height: 120px;
    resize: vertical;
}

.project-form input::placeholder,
.project-form textarea::placeholder {
    color: rgba(255, 255, 255, .35);
}

.project-form input:focus,
.project-form textarea:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(156, 255, 0, .12);
}

.project-form img.preview {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(255,255,255,0.1);
}

/* Custom Select Dropdown */
.project-form select {
    width: 100%;
    padding: 14px 44px 14px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .06);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    margin-bottom: 18px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--green) 50%),
        linear-gradient(135deg, var(--green) 50%, transparent 50%);
    background-position:
        calc(100% - 20px) 55%,
        calc(100% - 14px) 55%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.project-form select option[disabled] { color: #999; }
.project-form select option { background: #050605; color: #fff; }

.project-form select:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(156, 255, 0, .12);
}

/* =====================================================
   6. RESPONSIVE BREAKPOINTS (Mobile Fixes)
   ===================================================== */

/* Tablet / Small Desktop */
@media (max-width: 1024px) {
    .projects-hero h1 { font-size: 56px; }
    .projects-grid { gap: 30px; }
}

/* Tablet Portrait / Mobile Landscape */
@media (max-width: 768px) {
    .projects-hero { padding: 130px 6% 50px; }
    .projects-hero h1 { font-size: 42px; }
    .projects-hero p { font-size: 15px; }
    
    .projects-section { padding: 20px 6% 80px; }
    
    /* Ensure grid strictly stacks on mobile */
    .projects-grid {
        grid-template-columns: 1fr; 
        gap: 24px;
    }

    .project-card { padding: 20px; }
    .project-card img { height: 200px; }

    /* Form Mobile Adjustments */
    .project-form-page { padding: 120px 6% 60px; }
    .project-form { padding: 28px 22px; border-radius: 16px; }
    
    /* font-size: 16px prevents iOS Safari from automatically zooming in on inputs */
    .project-form input,
    .project-form textarea,
    .project-form select {
        font-size: 16px;
        padding: 13px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .projects-hero { padding: 110px 5% 40px; }
    .projects-hero h1 { font-size: 34px; }
    
    .projects-section { padding: 10px 5% 60px; }
    .project-card img { height: 180px; }
    .project-card h3 { font-size: 20px; }
    
    /* Form Small Mobile Adjustments */
    .project-form-page { padding: 100px 5% 50px; }
    .project-form { padding: 22px 16px; border-radius: 14px; }
    .project-form img.preview { height: 160px; }
}