/* Auth pages, Admin panel, and File Manager shared styles */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    background: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
}

/* ---- Auth Card Layout ---- */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.auth-card h1 {
    font-size: 22px;
    color: #e94560;
    margin-bottom: 6px;
    text-align: center;
}

.auth-card .subtitle {
    text-align: center;
    color: #888;
    font-size: 13px;
    margin-bottom: 24px;
}

.auth-card .form-group {
    margin-bottom: 16px;
}

.auth-card label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    color: #bbb;
}

.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    background: #0f3460;
    color: #fff;
    border: 1px solid #1a4a8a;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.auth-card input:focus {
    border-color: #e94560;
}

.auth-card input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-card .btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.auth-card .btn-primary {
    background: #e94560;
    color: #fff;
}

.auth-card .btn-primary:hover {
    background: #c73a52;
}

.auth-card .btn-primary:disabled {
    background: #666;
    cursor: not-allowed;
}

.auth-card .btn-secondary {
    background: #0f3460;
    color: #ddd;
    border: 1px solid #1a4a8a;
    margin-top: 8px;
}

.auth-card .btn-secondary:hover {
    background: #1a4a8a;
}

.auth-card .links {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
}

.auth-card .links a {
    color: #e94560;
    text-decoration: none;
}

.auth-card .links a:hover {
    text-decoration: underline;
}

.auth-card .error-msg {
    background: rgba(233, 69, 96, 0.15);
    border: 1px solid #e94560;
    color: #ff6b85;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.auth-card .success-msg {
    background: rgba(46, 204, 113, 0.15);
    border: 1px solid #2ecc71;
    color: #2ecc71;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.auth-card .step { display: none; }
.auth-card .step.active { display: block; }

/* ---- Top Nav Bar (shared by admin, manage, etc.) ---- */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
}

.top-nav .brand {
    font-size: 16px;
    font-weight: 700;
    color: #e94560;
    text-decoration: none;
}

.top-nav .nav-links {
    display: flex;
    gap: 16px;
    align-items: center;
}

.top-nav .nav-links a {
    color: #ccc;
    text-decoration: none;
    font-size: 13px;
}

.top-nav .nav-links a:hover {
    color: #e94560;
}

.top-nav .nav-links a.active {
    color: #e94560;
    font-weight: 600;
}

.top-nav .user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.top-nav .user-menu .user-name {
    color: #aaa;
}

.top-nav .user-menu button {
    padding: 4px 12px;
    background: #0f3460;
    color: #ddd;
    border: 1px solid #1a4a8a;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.top-nav .user-menu button:hover {
    background: #1a4a8a;
}

/* ---- Admin Panel ---- */
.admin-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
}

.admin-tabs button {
    padding: 8px 20px;
    background: #0f3460;
    color: #ccc;
    border: 1px solid #1a4a8a;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-size: 13px;
}

.admin-tabs button.active {
    background: #16213e;
    color: #e94560;
    border-bottom-color: #16213e;
    font-weight: 600;
}

.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th {
    text-align: left;
    padding: 10px 12px;
    background: #0f3460;
    color: #e94560;
    border-bottom: 2px solid #1a4a8a;
}

.admin-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #0f3460;
}

.admin-table tr:hover td {
    background: rgba(15, 52, 96, 0.4);
}

.admin-table .badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.badge-admin { background: #e94560; color: #fff; }
.badge-user { background: #0f3460; color: #ccc; }
.badge-active { background: #2ecc71; color: #000; }
.badge-inactive { background: #666; color: #fff; }
.badge-pending { background: #f39c12; color: #000; }
.badge-accepted { background: #2ecc71; color: #000; }
.badge-expired { background: #666; color: #fff; }

.admin-table button {
    padding: 3px 8px;
    background: #0f3460;
    color: #ddd;
    border: 1px solid #1a4a8a;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    margin-right: 4px;
}

.admin-table button:hover { background: #1a4a8a; }
.admin-table button.btn-danger { background: #7a1a1a; border-color: #a33; }
.admin-table button.btn-danger:hover { background: #a33; }

.invite-form {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.invite-form input {
    flex: 1;
    padding: 8px 12px;
    background: #0f3460;
    color: #fff;
    border: 1px solid #1a4a8a;
    border-radius: 6px;
    font-size: 14px;
}

.invite-form input:focus {
    outline: none;
    border-color: #e94560;
}

.invite-form button {
    padding: 8px 20px;
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.invite-form button:hover { background: #c73a52; }

/* ---- File Manager ---- */
.manage-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    height: calc(100vh - 49px);
}

.folder-sidebar {
    background: #16213e;
    border-right: 1px solid #0f3460;
    overflow-y: auto;
    padding: 12px;
}

.folder-sidebar h3 {
    font-size: 13px;
    color: #e94560;
    margin-bottom: 8px;
}

.folder-tree-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    margin-bottom: 2px;
}

.folder-tree-item:hover {
    background: rgba(15, 52, 96, 0.6);
}

.folder-tree-item.active {
    background: #0f3460;
    color: #e94560;
}

.folder-tree-item .folder-icon {
    font-size: 14px;
}

.folder-tree-item .folder-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.folder-children {
    padding-left: 16px;
}

.main-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.manage-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
}

.manage-toolbar button {
    padding: 6px 12px;
    background: #0f3460;
    color: #ddd;
    border: 1px solid #1a4a8a;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.manage-toolbar button:hover { background: #1a4a8a; }

.manage-toolbar .btn-primary {
    background: #e94560;
    color: #fff;
    border: none;
}

.manage-toolbar .btn-primary:hover { background: #c73a52; }

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    font-size: 13px;
    color: #aaa;
}

.breadcrumb a {
    color: #e94560;
    text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

.breadcrumb .sep {
    color: #666;
    margin: 0 2px;
}

.designs-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    padding: 16px;
    align-content: start;
}

.design-card {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
}

.design-card:hover {
    border-color: #e94560;
    transform: translateY(-2px);
}

.design-card .thumb {
    aspect-ratio: 1;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #0f3460;
}

.design-card .thumb.folder-thumb {
    background: #0d1b3e;
    color: #e94560;
}

.design-card .card-info {
    padding: 8px 10px;
}

.design-card .card-title {
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.design-card .card-date {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
}

/* Context menu */
.context-menu {
    position: fixed;
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 6px;
    padding: 4px 0;
    min-width: 160px;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    display: none;
}

.context-menu.visible {
    display: block;
}

.context-menu-item {
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
}

.context-menu-item:hover {
    background: #0f3460;
}

.context-menu-item.danger {
    color: #e94560;
}

.context-menu-separator {
    border-top: 1px solid #0f3460;
    margin: 4px 0;
}

/* Move dialog */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.hidden { display: none; }

.modal-dialog {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 12px;
    padding: 24px;
    min-width: 320px;
    max-width: 450px;
    width: 90%;
}

.modal-dialog h3 {
    color: #e94560;
    margin-bottom: 16px;
    font-size: 16px;
}

.modal-dialog input {
    width: 100%;
    padding: 8px 12px;
    background: #0f3460;
    color: #fff;
    border: 1px solid #1a4a8a;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 12px;
}

.modal-dialog input:focus {
    outline: none;
    border-color: #e94560;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.modal-actions button {
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    border: none;
}

.modal-actions .btn-ok {
    background: #e94560;
    color: #fff;
}

.modal-actions .btn-ok:hover { background: #c73a52; }

.modal-actions .btn-cancel {
    background: #0f3460;
    color: #ddd;
    border: 1px solid #1a4a8a;
}

.modal-actions .btn-cancel:hover { background: #1a4a8a; }

.move-folder-list {
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.move-folder-option {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 2px;
}

.move-folder-option:hover { background: rgba(15, 52, 96, 0.6); }
.move-folder-option.selected { background: #0f3460; color: #e94560; }

.empty-state {
    text-align: center;
    color: #666;
    padding: 60px 20px;
    font-size: 14px;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* Admin reset password dialog */
.reset-pw-dialog {
    display: none;
}

.reset-pw-dialog.visible {
    display: block;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0a0a1a; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* User menu in index.html toolbar */
.user-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    font-size: 12px;
}

.user-toolbar .user-name {
    color: #aaa;
}

.user-toolbar a {
    color: #e94560;
    text-decoration: none;
    font-size: 12px;
}

.user-toolbar a:hover { text-decoration: underline; }

.user-toolbar button {
    padding: 3px 8px;
    background: #0f3460;
    color: #ddd;
    border: 1px solid #1a4a8a;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
}

.user-toolbar button:hover { background: #1a4a8a; }

/* Profile section on auth cards */
.profile-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #0f3460;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.toggle-row label {
    margin: 0;
}

.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #0f3460;
    border-radius: 11px;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: #ccc;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: #e94560;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: #fff;
}
