/* --- Global Styles & Variables --- */
:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --background-color: #f8f9fa;
    --container-bg: #ffffff;
    --text-color: #343a40;
    --border-color: #dee2e6;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --border-radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    line-height: 1.6;
}

/* --- Login Page (auth.php) --- */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 20px;
}

.login-box {
    background: var(--container-bg);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 350px;
    text-align: center;
}

.login-box h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.login-box .form-group {
    margin-bottom: 15px;
    text-align: left;
}

.login-box input[type="text"],
.login-box input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.login-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.login-box button {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
    transition: background-color 0.2s;
}

.login-box button:hover {
    background: var(--primary-hover);
}

.login-box .error {
    color: #dc3545;
    margin-bottom: 15px;
    font-size: 0.9em;
}


/* --- Main Dashboard (index.php) --- */
.header {
    background: var(--container-bg);
    padding: 20px 40px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-bottom: 1px solid var(--border-color);
}

.header h1 {
    margin: 0;
    font-size: 1.8em;
    color: var(--primary-color);
}

.main-container {
    padding: 30px;
}

.group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
}

.group-card {
    background: var(--container-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 25px;
    text-align: center;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-left: 5px solid transparent;
}

.group-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.group-card h2 {
    margin: 0 0 15px 0;
    font-size: 1.4em;
}

.group-card .button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
    display: inline-block;
}

.group-card .button:hover {
    background-color: var(--primary-hover);
}

/* Card border colors */
.group-card.c-1 { border-color: #e57373; }
.group-card.c-2 { border-color: #ffb74d; }
.group-card.c-3 { border-color: #fff176; }
.group-card.c-4 { border-color: #81c784; }
.group-card.c-5 { border-color: #4db6ac; }
.group-card.c-6 { border-color: #64b5f6; }
.group-card.c-7 { border-color: #7986cb; }
.group-card.c-8 { border-color: #9575cd; }
.group-card.c-9 { border-color: #90a4ae; }
.group-card.c-10{ border-color: #a1887f; }


/* --- File Manager (group.php) --- */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.top-bar .title-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.top-bar .back-btn {
    font-size: 1.5em;
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s;
}
.top-bar .back-btn:hover {
    color: var(--primary-color);
}


.top-bar h2 {
    margin: 0;
    font-size: 2em;
}

.actions-menu {
    position: relative;
}

.actions-menu .menu-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: background-color 0.2s, transform 0.2s;
}

.actions-menu .menu-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.actions-menu .dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 60px;
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    z-index: 100;
    overflow: hidden;
    width: 200px;
}

.actions-menu .dropdown a,
.actions-menu .dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.2s;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 1em;
}

.actions-menu .dropdown a:hover,
.actions-menu .dropdown button:hover {
    background: #f1f1f1;
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.item {
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    padding: 15px;
    text-align: center;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    word-wrap: break-word;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 150px;
}

.item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.1);
    transform: translateY(-3px);
}

.item .icon {
    width: 50px;
    height: 50px;
    margin-bottom: 10px;
}

.item .file-name {
    font-size: 0.9em;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item img, .item video {
    max-width: 100px;
    max-height: 80px;
    border-radius: 5px;
    object-fit: cover;
    margin-bottom: 10px;
}

/* --- Modal Styles --- */
.modal-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--container-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 500px;
    position: relative;
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #888;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
}

.modal-content .form-group {
    margin-bottom: 20px;
}

.modal-content input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-buttons button {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: bold;
}

.modal-buttons .btn-primary {
    background: var(--primary-color);
    color: white;
}
.modal-buttons .btn-secondary {
    background: #e9ecef;
    color: var(--text-color);
}

/* Upload Modal */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}
.upload-area:hover {
    border-color: var(--primary-color);
}
.upload-area p { margin: 0; }
.upload-area input[type="file"] {
    display: none;
}

/* --- Preview Overlay --- */
.preview-overlay {
    display: none; /* Hidden */
    position: fixed;
    top:0; left:0;
    width:100%; height:100%;
    background: rgba(0,0,0,0.85);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.preview-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
}
.preview-content img,
.preview-content video,
.preview-content iframe {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
}
.preview-content iframe {
    width: 80vw;
    height: 85vh;
    background: white;
}
.preview-close-btn {
    position: absolute;
    top: -45px;
    right: -5px;
    font-size: 32px;
    color: white;
    cursor: pointer;
    background: transparent;
    border: none;
}