:root {
    --ag-auth-bg: rgba(255, 255, 255, 0.75);
    --ag-auth-border: rgba(0, 0, 0, 0.06);
    --ag-auth-text: #0f172a;
    --ag-auth-text-muted: #64748b;
    --ag-auth-primary: #4f46e5;
    --ag-auth-danger: #ef4444;
    --ag-auth-input-bg: rgba(255, 255, 255, 0.5);
    --ag-auth-input-border: rgba(0, 0, 0, 0.08);
    --ag-auth-input-focus: rgba(255, 255, 255, 0.95);
}

body.dark-mode {
    --ag-auth-bg: rgba(15, 23, 42, 0.75);
    --ag-auth-border: rgba(255, 255, 255, 0.06);
    --ag-auth-text: #f8fafc;
    --ag-auth-text-muted: #94a3b8;
    --ag-auth-primary: #6366f1;
    --ag-auth-danger: #f87171;
    --ag-auth-input-bg: rgba(0, 0, 0, 0.2);
    --ag-auth-input-border: rgba(255, 255, 255, 0.08);
    --ag-auth-input-focus: rgba(15, 23, 42, 0.9);
}

.ag-auth-glass-modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    direction: rtl;
    font-family: inherit;
}

.ag-auth-glass-modal.active {
    display: flex;
}

.ag-auth-liquid-panel {
    background: var(--ag-auth-bg);
    border: 1px solid var(--ag-auth-border);
    width: 100%;
    max-width: 380px;
    border-radius: 20px;
    position: relative;
    padding: 24px 20px;
    color: var(--ag-auth-text);
    box-sizing: border-box;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.15);
    overflow: hidden;
}

.ag-auth-liquid-panel .ag-liquid-bg {
    display: none;
}

.ag-close-auth-modal {
    position: absolute;
    top: 14px;
    left: 18px;
    font-size: 24px;
    color: var(--ag-auth-text-muted);
    cursor: pointer;
    z-index: 10;
    transition: color 0.15s ease;
    line-height: 1;
}

.ag-close-auth-modal:hover {
    color: var(--ag-auth-danger);
}

.ag-auth-inner {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
}

.ag-auth-title {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    color: var(--ag-auth-text);
    letter-spacing: -0.02em;
}

.ag-auth-subtitle {
    margin: 0 0 16px 0;
    font-size: 12px;
    text-align: center;
    color: var(--ag-auth-text-muted);
}

.ag-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: var(--ag-auth-input-bg);
    border: 1px solid var(--ag-auth-input-border);
    color: var(--ag-auth-text) !important;
    padding: 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.ag-google-btn svg {
    background: transparent !important;
}

.ag-google-btn:hover {
    background: var(--ag-auth-input-focus);
    border-color: var(--ag-auth-text-muted);
}

.ag-google-btn.loading {
    opacity: 0.6;
    pointer-events: none;
}

.ag-auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 16px 0;
    color: var(--ag-auth-text-muted);
    font-size: 11px;
}

.ag-auth-divider::before, .ag-auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--ag-auth-input-border);
}

.ag-auth-divider span {
    padding: 0 12px;
}

.ag-input-wrap {
    margin-bottom: 10px;
}

.ag-auth-input {
    width: 100%;
    background: var(--ag-auth-input-bg);
    border: 1px solid var(--ag-auth-input-border);
    border-radius: 12px;
    height: 42px;
    padding: 0 14px;
    font-size: 13px;
    color: var(--ag-auth-text);
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.ag-auth-input:focus {
    border-color: var(--ag-auth-primary);
    background: var(--ag-auth-input-focus);
}

.ag-auth-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 14px;
    font-size: 12px;
}

.ag-forgot-pwd {
    color: var(--ag-auth-primary);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.15s ease;
}

.ag-forgot-pwd:hover {
    opacity: 0.8;
}

.ag-auth-submit-btn {
    width: 100%;
    background: var(--ag-auth-primary);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    height: 42px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.ag-auth-submit-btn:hover {
    opacity: 0.95;
}

.ag-auth-submit-btn.loading .ag-btn-text {
    display: none;
}

.ag-auth-submit-btn .ag-btn-loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: ag-spin 0.6s linear infinite;
    display: none;
}

.ag-auth-submit-btn.loading .ag-btn-loader {
    display: block;
}

@keyframes ag-spin {
    to { transform: rotate(360deg); }
}

.ag-auth-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 12px;
    color: var(--ag-auth-text-muted);
}

.ag-auth-footer a {
    color: var(--ag-auth-primary);
    font-weight: 600;
    text-decoration: none;
}

.ag-auth-msg {
    margin-bottom: 10px;
}

.ag-auth-msg .ag-msg {
    padding: 8px;
    border-radius: 10px;
    font-size: 12px;
    text-align: center;
}

.ag-auth-msg .ag-msg.error {
    background: rgba(239,68,68,0.08);
    color: var(--ag-auth-danger);
}

.ag-auth-msg .ag-msg.success {
    background: rgba(16, 185, 129, 0.08);
    color: #10b981;
}

@media (max-width: 480px) {
    .ag-auth-liquid-panel {
        padding: 20px 16px;
    }
}