/* 
 * Guestbook CSS - Modern & Beautiful
 * Compatible with existing CAPTCHA images in /img folder
 */

/* ===== VARIABLES ===== */
:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --secondary: #7209b7;
    --accent: #f72585;
    --success: #4cc9f0;
    --danger: #f94144;
    --warning: #f8961e;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --border-radius: 16px;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.18);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient-primary: linear-gradient(135deg, #4361ee, #3a0ca3);
    --gradient-secondary: linear-gradient(135deg, #7209b7, #f72585);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Poppins', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.7;
    color: var(--dark);
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
    min-height: 100vh;
    padding: 20px;
    background-attachment: fixed;
}

/* ===== CONTAINERS ===== */
.container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== HEADER ===== */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow);
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><path d="M0,100 Q50,80 100,100 L100,0 Q50,20 0,0 Z" fill="rgba(255,255,255,0.1)"/></svg>');
    background-size: 100% 100%;
}

.header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    position: relative;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #fff, #e0e7ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.card-header {
    background: var(--gradient-secondary);
    color: white;
    padding: 25px 30px;
    position: relative;
    overflow: hidden;
}

.card-header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.card-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-header h2::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.card-body {
    padding: 30px;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--dark);
    font-size: 1rem;
    letter-spacing: 0.3px;
}

.form-control {
    width: 100%;
    padding: 16px 20px;
    font-size: 1rem;
    font-family: inherit;
    background: rgba(248, 249, 250, 0.8);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: var(--transition);
    color: var(--dark);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.15);
}

.form-control:hover {
    border-color: #cbd5e1;
}

textarea.form-control {
    min-height: 160px;
    resize: vertical;
    line-height: 1.6;
}

.form-text {
    display: block;
    margin-top: 8px;
    font-size: 0.875rem;
    color: var(--gray);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 32px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-3px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3a56d4, #2a0b8c);
    box-shadow: 0 8px 25px rgba(67, 97, 238, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268, #343a40);
}

.btn-success {
    background: linear-gradient(135deg, #4cc9f0, #4361ee);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #3ab5d9, #3a56d4);
}

.btn-danger {
    background: linear-gradient(135deg, #f94144, #f3722c);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #d90429, #f3722c);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-lg {
    padding: 18px 40px;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 10px 20px;
    font-size: 0.9rem;
}

/* ===== EMOJI PICKER ===== */
.emoji-section {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 2px dashed #cbd5e1;
}

.emoji-section h4 {
    margin-bottom: 15px;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

.emoji-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 10px;
}

.emoji-picker::-webkit-scrollbar {
    width: 6px;
}

.emoji-picker::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.emoji-picker::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.emoji-btn {
    font-size: 1.8rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.emoji-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.1) rotate(5deg);
}

.emoji-btn:active {
    transform: scale(0.95);
}

/* ===== CAPTCHA ===== */
.captcha-container {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-radius: 12px;
    padding: 25px;
    margin: 25px 0;
    border: 2px solid #e2e8f0;
}

.captcha-images {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    background: white;
    padding: 10px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
}

.captcha-img {
    height: 50px;
    width: 40px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.captcha-img:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* ===== COMMENTS ===== */
.comments-section {
    margin-top: 40px;
}

.comment {
    background: white;
    border-radius: 14px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.comment::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: var(--gradient-primary);
}

.comment:hover {
    transform: translateX(8px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.comment-author {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.comment-author::before {
    content: '👤';
    font-size: 1.4rem;
    opacity: 0.7;
}

.comment-date {
    color: var(--gray);
    font-size: 0.95rem;
    font-weight: 500;
    background: #f8f9fa;
    padding: 6px 12px;
    border-radius: 20px;
}

.comment-content {
    color: #2d3748;
    line-height: 1.8;
    font-size: 1.05rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    padding-left: 5px;
}

.comment-content p {
    margin-bottom: 10px;
}

.comment-content p:last-child {
    margin-bottom: 0;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    color: var(--dark);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.page-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.page-link.active {
    background: var(--gradient-primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

/* ===== ADMIN STYLES ===== */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.admin-nav {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.admin-nav h1 {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 2.2rem;
    font-weight: 800;
}

.nav-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--gradient-primary);
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
}

.stat-card h3 {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 10px;
    font-weight: 800;
}

.stat-card p {
    color: var(--gray);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.stat-card.total::before {
    background: var(--gradient-primary);
}

.stat-card.pending::before {
    background: linear-gradient(135deg, #f8961e, #f3722c);
}

.stat-card.approved::before {
    background: linear-gradient(135deg, #4cc9f0, #4361ee);
}

/* ===== TABLES ===== */
.comments-table {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.table-header {
    background: var(--gradient-secondary);
    color: white;
    padding: 20px 30px;
    font-weight: 600;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-content {
    padding: 20px;
}

.comment-row {
    padding: 25px;
    border-bottom: 1px solid #e2e8f0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 25px;
    align-items: start;
    transition: var(--transition);
}

.comment-row:hover {
    background: #f8fafc;
}

.comment-row:last-child {
    border-bottom: none;
}

.comment-info {
    flex: 1;
}

.comment-name {
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-meta {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.comment-text {
    color: #4a5568;
    line-height: 1.7;
    white-space: pre-wrap;
}

.comment-actions {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

/* ===== LOGIN FORM ===== */
.login-form-container {
    max-width: 450px;
    margin: 80px auto;
}

/* ===== EMPTY STATES ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-icon {
    font-size: 4.5rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* ===== FOOTER ===== */
.footer {
    text-align: center;
    margin-top: 60px;
    padding: 30px 0;
    color: var(--gray);
    border-top: 2px solid #e2e8f0;
    font-size: 0.95rem;
}

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.text-muted { color: var(--gray) !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }

.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }

.d-flex { display: flex !important; }
.flex-column { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }
.align-items-center { align-items: center !important; }
.align-items-start { align-items: flex-start !important; }

.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in {
    animation: slideIn 0.4s ease forwards;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .header {
        padding: 30px 20px;
        margin-bottom: 30px;
    }
    
    .header h1 {
        font-size: 2.5rem;
    }
    
    .card-body {
        padding: 25px;
    }
    
    .btn {
        padding: 14px 28px;
        font-size: 0.95rem;
    }
    
    .emoji-btn {
        width: 48px;
        height: 48px;
        font-size: 1.6rem;
    }
    
    .captcha-img {
        height: 55px;
        width: 45px;
    }
    
    .comment {
        padding: 25px;
    }
    
    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .comment-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .comment-actions {
        justify-content: flex-start;
    }
    
    .admin-nav {
        flex-direction: column;
        text-align: center;
    }
    
    .nav-buttons {
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-control {
        padding: 14px 18px;
        font-size: 16px; /* Prevents iOS zoom */
    }
}

@media (max-width: 480px) {
    body {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .emoji-picker {
        max-height: 150px;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .comment-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .comment-actions .btn {
        width: 100%;
    }
}

/* ===== DARK MODE ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --light: #121212;
        --dark: #e0e0e0;
        --gray: #a0a0a0;
    }
    
    body {
        background: linear-gradient(135deg, #0f172a, #1e293b);
        color: var(--dark);
    }
    
    .card {
        background: #1e293b;
        border-color: #334155;
    }
    
    .form-control {
        background: #2d3748;
        border-color: #4a5568;
        color: var(--dark);
    }
    
    .form-control:focus {
        background: #2d3748;
    }
    
    .comment {
        background: #1e293b;
        border-color: #334155;
    }
    
    .comment-date {
        background: #2d3748;
    }
    
    .emoji-section {
        background: linear-gradient(135deg, #2d3748, #4a5568);
        border-color: #4a5568;
    }
    
    .emoji-btn {
        background: #4a5568;
        border-color: #64748b;
        color: white;
    }
    
    .captcha-container {
        background: linear-gradient(135deg, #2d3748, #4a5568);
        border-color: #4a5568;
    }
    
    .captcha-images {
        background: #4a5568;
        border-color: #64748b;
    }
    
    .page-link {
        background: #2d3748;
        border-color: #4a5568;
        color: var(--dark);
    }
    
    .text-muted {
        color: #a0a0a0 !important;
    }
    
    .admin-nav {
        background: #1e293b;
    }
    
    .stat-card {
        background: #1e293b;
    }
    
    .comments-table {
        background: #1e293b;
    }
    
    .comment-row:hover {
        background: #2d3748;
    }
    
    .comment-meta {
        color: #a0a0a0;
    }
    
    .comment-text {
        color: #d1d5db;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    body {
        background: white !important;
        color: black !important;
        padding: 0;
    }
    
    .header, .card-header, .btn, .emoji-section, 
    .captcha-container, form, .admin-nav, .comment-actions {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        margin-bottom: 20px;
    }
    
    .comment {
        break-inside: avoid;
        border-left: 3px solid #4361ee !important;
        box-shadow: none !important;
    }
}
