/**
 * Qualiphy Marketing Admin Panel Styles
 * Matches the Qualiphy Plugin design system
 *
 * Color Palette:
 * - Primary Purple: #3d2b64
 * - Primary Hover: #2d1f4a
 * - Primary Light: #6e54a7
 * - Success: #28a745
 * - Error: #dc3232
 * - Warning: #856404
 * - Text: #1d2327
 * - Text Muted: #666
 * - Border: #ddd
 * - Background: #f0f0f1
 */

/* ========================================
   RESET & BASE STYLES
   ======================================== */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Karla', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1d2327;
    background-color: #f0f0f1;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Karma', Georgia, serif;
    font-weight: 600;
    line-height: 1.3;
    color: #1d2327;
    margin-bottom: 0.5em;
}

h1 { font-size: 28px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 18px; }
h5 { font-size: 16px; }
h6 { font-size: 14px; }

a {
    color: #3d2b64;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #2d1f4a;
}

img {
    max-width: 100%;
    height: auto;
}

/* ========================================
   LOGIN PAGE STYLES
   ======================================== */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #3d2b64 0%, #6e54a7 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo img {
    max-width: 180px;
    height: auto;
}

.login-logo h1 {
    color: #fff;
    font-size: 32px;
    margin-top: 15px;
    margin-bottom: 5px;
}

.login-logo p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px;
}

.login-card h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #3d2b64;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1d2327;
}

.login-form .qualiphy-input {
    width: 100%;
}

.login-form .form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.login-form .remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.login-form .remember-me input {
    width: 16px;
    height: 16px;
    accent-color: #3d2b64;
}

.login-form .forgot-password {
    font-size: 13px;
    color: #3d2b64;
}

.login-form .forgot-password:hover {
    text-decoration: underline;
}

.login-form .qualiphy-btn {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
}

.login-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-error::before {
    content: "\26A0";
    font-size: 18px;
}

.login-success {
    background: #d4edda;
    color: #155724;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

.qualiphy-input,
.qualiphy-select,
.qualiphy-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: #1d2327;
    background: #fff;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.qualiphy-input:focus,
.qualiphy-select:focus,
.qualiphy-textarea:focus {
    outline: none;
    border-color: #3d2b64;
    box-shadow: 0 0 0 2px rgba(61, 43, 100, 0.2);
}

.qualiphy-input::placeholder {
    color: #8c8f94;
}

.qualiphy-input--error {
    border-color: #dc3232;
}

.qualiphy-input--error:focus {
    box-shadow: 0 0 0 2px rgba(220, 50, 50, 0.2);
}

.qualiphy-textarea {
    min-height: 100px;
    resize: vertical;
}

.qualiphy-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238c8f94' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ========================================
   BUTTONS
   ======================================== */

.qualiphy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #3d2b64;
    color: #fff;
}

.qualiphy-btn:hover {
    background: #2d1f4a;
    color: #fff;
}

.qualiphy-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(61, 43, 100, 0.4);
}

.qualiphy-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.qualiphy-btn--secondary {
    background: #f0f0f1;
    color: #3d2b64;
}

.qualiphy-btn--secondary:hover {
    background: #e0e0e0;
    color: #2d1f4a;
}

.qualiphy-btn--outline {
    background: transparent;
    color: #3d2b64;
    border: 1px solid #3d2b64;
}

.qualiphy-btn--outline:hover {
    background: #3d2b64;
    color: #fff;
}

.qualiphy-btn--danger {
    background: #dc3232;
    color: #fff;
}

.qualiphy-btn--danger:hover {
    background: #b52727;
}

.qualiphy-btn--small {
    padding: 6px 12px;
    font-size: 13px;
}

.qualiphy-btn--large {
    padding: 14px 28px;
    font-size: 16px;
}

/* ========================================
   ADMIN LAYOUT
   ======================================== */

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background: #3d2b64;
    color: #fff;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
}

.sidebar-logo img {
    width: 40px;
    height: 40px;
}

.sidebar-logo span {
    font-family: 'Karma', serif;
    font-size: 20px;
    font-weight: 600;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-section {
    margin-bottom: 25px;
}

.nav-section-title {
    padding: 0 20px;
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.5);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-left-color: #fff;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item span {
    flex: 1;
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-left: 260px;
    min-width: 0;
}

.admin-header {
    background: #fff;
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #1d2327;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-dropdown {
    position: relative;
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f5f5f5;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.user-dropdown-toggle:hover {
    background: #e5e5e5;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #3d2b64;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-info {
    text-align: left;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: #1d2327;
}

.user-role {
    font-size: 12px;
    color: #666;
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    display: none;
    z-index: 100;
}

.user-dropdown.open .user-dropdown-menu {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #1d2327;
    text-decoration: none;
    transition: background 0.2s ease;
}

.dropdown-item:hover {
    background: #f5f5f5;
}

.dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

.dropdown-divider {
    height: 1px;
    background: #ddd;
    margin: 4px 0;
}

.dropdown-item--danger {
    color: #dc3232;
}

.dropdown-item--danger:hover {
    background: #fef7f7;
}

/* Page Content */
.admin-content {
    padding: 30px;
}

/* ========================================
   CARDS
   ======================================== */

.qualiphy-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 20px;
}

.qualiphy-card--small {
    padding: 20px;
}

.qualiphy-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.qualiphy-card__title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.qualiphy-card__actions {
    display: flex;
    gap: 10px;
}

/* ========================================
   BADGES
   ======================================== */

.qualiphy-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    background: #e0e0e0;
    color: #666;
}

.qualiphy-badge--success {
    background: #d4edda;
    color: #155724;
}

.qualiphy-badge--error {
    background: #f8d7da;
    color: #721c24;
}

.qualiphy-badge--warning {
    background: #fff3cd;
    color: #856404;
}

.qualiphy-badge--info {
    background: #d1ecf1;
    color: #0c5460;
}

.qualiphy-badge--pill {
    border-radius: 20px;
}

/* ========================================
   UTILITIES
   ======================================== */

.qualiphy-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 20px 0;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #666; }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }

/* ========================================
   LOADING SPINNER
   ======================================== */

.qualiphy-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: #3d2b64;
    border-radius: 50%;
    animation: qualiphy-spin 0.8s linear infinite;
}

.qualiphy-spinner--small {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.qualiphy-spinner--large {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

@keyframes qualiphy-spin {
    to { transform: rotate(360deg); }
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }

    .sidebar-overlay.active {
        display: block;
    }
}

@media (max-width: 768px) {
    .admin-header {
        padding: 15px 20px;
    }

    .admin-content {
        padding: 20px;
    }

    .qualiphy-card {
        padding: 20px;
    }

    .login-card {
        padding: 30px 25px;
    }

    .user-info {
        display: none;
    }
}

@media (max-width: 480px) {
    .admin-content {
        padding: 15px;
    }

    .login-card {
        padding: 25px 20px;
    }

    .login-logo h1 {
        font-size: 26px;
    }
}
