/**
 * PhotoLayout SaaS - Core Stylesheet
 * Clean, fast, mobile-first CSS designed for low-cost SaaS on cPanel
 */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --success: #10b981;
    --success-hover: #059669;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-body);
    background-image:
        radial-gradient(1200px 600px at 0% 0%, rgba(99, 102, 241, 0.10), transparent 60%),
        radial-gradient(900px 500px at 100% 0%, rgba(236, 72, 153, 0.08), transparent 60%),
        radial-gradient(900px 600px at 50% 100%, rgba(16, 185, 129, 0.07), transparent 60%),
        linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* Navbar */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.brand-icon {
    font-size: 1.5rem;
}

.brand-text strong {
    color: var(--primary);
}

/* Badges */
.network-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.65rem;
    background: #f1f5f9;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-online {
    background-color: var(--success);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.dot-offline {
    background-color: var(--danger);
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.subscription-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.sub-badge-active {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.sub-badge-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.sub-badge-expired {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.btn-logout {
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.btn-logout:hover {
    color: var(--danger);
    background: #fef2f2;
}

/* Offline Banner */
.offline-banner {
    background: #fef3c7;
    color: #92400e;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    text-align: center;
    border-bottom: 1px solid #fde68a;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* Auth Pages (Login/Signup) */
.auth-wrapper {
    max-width: 440px;
    margin: 2rem auto;
}

.auth-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.auth-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}

.form-input, .form-select {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: #fff;
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.25s ease, filter 0.2s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn:active:not(:disabled) {
    transform: scale(0.97);
}

/* Gradient animated buttons */
.btn-primary,
.btn-success,
.btn-danger {
    color: #fff;
    background-size: 300% 100%;
    animation: btnGradShift 6s ease infinite;
}

.btn-primary { background-image: linear-gradient(120deg, #2563eb, #6366f1, #8b5cf6, #2563eb); box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3); }
.btn-success { background-image: linear-gradient(120deg, #10b981, #06b6d4, #3b82f6, #10b981); box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3); }
.btn-danger  { background-image: linear-gradient(120deg, #ef4444, #f43f5e, #ec4899, #ef4444); box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3); }

/* Shine sweep on hover */
.btn-primary::after,
.btn-success::after,
.btn-danger::after {
    content: "";
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s ease;
    pointer-events: none;
}

.btn-primary:hover,
.btn-success:hover,
.btn-danger:hover {
    color: #fff;
    filter: brightness(1.07);
    transform: translateY(-1px);
}

.btn-primary:hover { box-shadow: 0 8px 22px rgba(99, 102, 241, 0.45); }
.btn-success:hover { box-shadow: 0 8px 22px rgba(16, 185, 129, 0.45); }
.btn-danger:hover  { box-shadow: 0 8px 22px rgba(239, 68, 68, 0.45); }

.btn-primary:hover::after,
.btn-success:hover::after,
.btn-danger:hover::after {
    left: 125%;
}

@keyframes btnGradShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.btn-secondary {
    background: #e2e8f0;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #e0e7ff, #fce7f3);
    color: var(--text-primary);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1.1rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    animation: none;
    transform: none;
}

/* Dashboard & Cards */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.dashboard-title h1 {
    font-size: 1.75rem;
    color: var(--text-primary);
}

.dashboard-title p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
    animation: fadeUp 0.45s ease both;
}

.card:hover {
    box-shadow: 0 12px 28px -8px rgba(99, 102, 241, 0.25);
    border-color: #c7d2fe;
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.card-details {
    margin: 1rem 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.detail-item {
    background: #f8fafc;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid #f1f5f9;
}

.detail-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.detail-value {
    font-weight: 600;
    color: var(--text-primary);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border-color);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    max-width: 450px;
    margin: 0 auto 1.5rem auto;
}

/* Event Page Header */
.event-page-banner {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.event-banner-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.event-banner-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chip {
    padding: 0.35rem 0.75rem;
    background: #f1f5f9;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.chip-primary {
    background: var(--primary-light);
    color: var(--primary);
}

/* Local Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.gallery-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.gallery-thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1.414; /* A4 aspect approx */
    background: #f1f5f9;
    overflow: hidden;
    cursor: pointer;
}

.gallery-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.gallery-thumb-wrap:hover .gallery-thumb {
    transform: scale(1.02);
}

.gallery-info {
    padding: 0.85rem;
    flex: 1;
}

.gallery-number {
    font-weight: 700;
    font-size: 1rem;
}

.gallery-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.gallery-actions {
    display: flex;
    padding: 0.5rem 0.85rem 0.85rem;
    gap: 0.4rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    max-width: 650px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    animation: modalPop 0.3s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.92) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: #1e293b;
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    animation: toastIn 0.25s ease-out;
    max-width: 380px;
}

.toast-success { background: #065f46; }
.toast-error { background: #991b1b; }
.toast-warning { background: #92400e; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Table styles for Admin & Data */
.table-responsive {
    overflow-x: auto;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th, .data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
}

/* Footer */
.app-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 1rem;
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.footer-privacy {
    margin-bottom: 0.5rem;
    color: #1e293b;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .nav-container {
        flex-wrap: wrap;
    }
    .user-greeting {
        display: none;
    }
    .grid-cards {
        grid-template-columns: 1fr;
    }
    .main-content {
        padding: 1rem 0.75rem;
    }
}
