/* Midnight Nebula Theme - Premium Glassmorphism */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600&display=swap');

:root {
    --bg-deep: #050505;
    --bg-gradient: radial-gradient(circle at 20% 20%, #1a0b2e 0%, #000000 100%);
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;

    /* Dynamic Accents */
    --accent-primary: #d500f9;
    --accent-secondary: #651fff;
    --accent-gradient: linear-gradient(135deg, #d500f9 0%, #651fff 100%);

    /* Refined Glass */
    --glass-bg: rgba(20, 20, 20, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.05);

    --success-color: #00e676;
    --error-color: #ff1744;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background: var(--bg-deep);
    background-image: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

.container {
    width: 90%;
    max-width: 900px;
    margin-top: 60px;
    position: relative;
    z-index: 1;
}

/* Ambient Glow Effects */
.container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(101, 31, 255, 0.15) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-highlight);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    box-shadow: 0 12px 40px 0 rgba(101, 31, 255, 0.1);
}

h1,
h2 {
    text-align: center;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 2rem;
    background: linear-gradient(to right, #fff, #b3b3b3);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.8rem;
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

input[type="text"],
input[type="password"],
input[type="file"],
input[type="number"] {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus {
    outline: none;
    border-color: var(--accent-secondary);
    box-shadow: 0 0 0 2px rgba(101, 31, 255, 0.2);
}

.sort-input {
    width: 100% !important;
    /* Override standard input constraint if needed, but actually standard is 100% so !important might be redundant, but clearer than inline */
    max-width: 150px;
}

button {
    width: 100%;
    padding: 1.2rem;
    border: none;
    border-radius: 12px;
    background: var(--accent-gradient);
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(213, 0, 249, 0.3);
}

button:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

/* Lists */
.file-list {
    list-style: none;
    padding: 0;
}

.file-item {
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 0.8rem;
    padding: 1.2rem;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.file-item:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--glass-border);
    transform: translateX(5px);
}

.file-item a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.file-item a:hover {
    color: var(--accent-primary);
}

/* Flash Messages */
.flash-messages {
    width: 100%;
    margin-bottom: 2rem;
}

.flash {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    text-align: center;
    backdrop-filter: blur(10px);
    font-weight: 500;
}

.flash.error {
    background: rgba(255, 23, 68, 0.15);
    border: 1px solid rgba(255, 23, 68, 0.3);
    color: #ff8a80;
}

.flash.success {
    background: rgba(0, 230, 118, 0.15);
    border: 1px solid rgba(0, 230, 118, 0.3);
    color: #b9f6ca;
}

/* Navbar */
.navbar {
    width: 100%;
    padding: 1.5rem 5%;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    border-bottom: 1px solid var(--glass-border);
}

.navbar .brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.navbar a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-left: 2rem;
    font-weight: 500;
    transition: color 0.3s;
}

.navbar a:hover {
    color: white;
}

/* Action Buttons */
.action-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 12px;
    font-size: 0;
    /* Hide any fallback text if present */
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.action-btn svg {
    width: 20px;
    height: 20px;
}

.action-btn.open {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--glass-border);
}

.action-btn.open:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.action-btn.edit {
    background: rgba(213, 0, 249, 0.1);
    color: var(--accent-primary);
    border-color: rgba(213, 0, 249, 0.3);
}

.action-btn.edit:hover {
    background: rgba(213, 0, 249, 0.2);
    box-shadow: 0 4px 12px rgba(213, 0, 249, 0.2);
    transform: translateY(-2px);
    color: #e040fb;
}

/* Delete Button */
.action-btn.delete {
    background: rgba(255, 23, 68, 0.1);
    color: var(--error-color);
    border-color: rgba(255, 23, 68, 0.3);
}

.action-btn.delete:hover {
    background: rgba(255, 23, 68, 0.2);
    box-shadow: 0 4px 12px rgba(255, 23, 68, 0.2);
    transform: translateY(-2px);
    color: #ff5252;
}

.fade-blink {
  animation: fade 2s infinite;
}

@keyframes fade {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .file-item>div {
        width: 100%;
    }

    .file-item>div:last-child {
        justify-content: flex-start;
        margin-top: 0.5rem;
    }
}