/*
Theme Name: Garden Portal
Description: A comprehensive WordPress theme for the Garden Portal SPA - a social platform for gardening enthusiasts
Author: Garden Portal Team
Version: 1.0.0
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: garden-portal
Tags: spa, social, gardening, community, responsive, accessibility-ready
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.4
*/

/* ==========================================================================
   Theme Styles
   ========================================================================== */

/* Reset and Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-weight: 400;
    color: #333;
    background-color: #fff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 1rem 0;
    font-weight: 600;
    line-height: 1.3;
    color: #2c3e50;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin: 0 0 1rem 0;
}

a {
    color: #4CAF50;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover,
a:focus {
    color: #45a049;
    text-decoration: underline;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col {
    flex: 1;
    padding: 0 15px;
}

/* Header */
.site-header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 20px;
}

.site-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #4CAF50;
}

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

/* Navigation */
.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 2rem;
}

.main-navigation a {
    color: #666;
    font-weight: 500;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.main-navigation a:hover,
.main-navigation a:focus {
    color: #4CAF50;
    border-bottom-color: #4CAF50;
    text-decoration: none;
}

/* Content */
.site-main {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

.content-area {
    flex: 1;
}

.sidebar {
    flex: 0 0 300px;
    margin-left: 2rem;
}

/* Garden Portal SPA Styles */
.garden-portal-spa {
    background: #f8f9fa;
}

.garden-portal-spa .site-main {
    padding: 0;
}

/* Fix admin bar positioning for SPA pages */
.garden-portal-spa.admin-bar {
    padding-top: 32px;
}

.garden-portal-spa.admin-bar .pecodex-main-header {
    margin-top: 0; /* Remove the margin-top that's causing issues */
}

@media screen and (max-width: 782px) {
    .garden-portal-spa.admin-bar {
        padding-top: 46px;
    }
}

/* Ensure admin bar is always visible on SPA pages */
.garden-portal-spa #wpadminbar {
    display: block !important;
    visibility: visible !important;
    z-index: 99999 !important;
}

.spa-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.spa-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    flex-direction: column;
    gap: 1rem;
}

.spa-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover,
.btn-primary:focus {
    background: #45a049;
    color: white;
    text-decoration: none;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover,
.btn-secondary:focus {
    background: #5a6268;
    color: white;
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    color: #4CAF50;
    border: 2px solid #4CAF50;
}

.btn-outline:hover,
.btn-outline:focus {
    background: #4CAF50;
    color: white;
    text-decoration: none;
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.form-control::placeholder {
    color: #999;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
}

/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

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

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: -9999px;
    z-index: 999999;
    padding: 8px 16px;
    background: #000;
    color: #fff;
    text-decoration: none;
}

.skip-link:focus {
    left: 6px;
    top: 7px;
}

/* Focus styles */
button:focus,
input:focus,
textarea:focus,
select:focus,
a:focus {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #333;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    .form-control {
        border: 2px solid #333;
    }
}

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

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .site-header {
        background: #2d2d2d;
        border-bottom-color: #404040;
    }
    
    .card {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .card-header,
    .card-footer {
        background: #404040;
        border-color: #555;
    }
    
    .form-control {
        background: #2d2d2d;
        border-color: #404040;
        color: #e0e0e0;
    }
    
    .form-control:focus {
        border-color: #4CAF50;
        box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
    }
    
    h1, h2, h3, h4, h5, h6 {
        color: #e0e0e0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .site-header .container {
        padding: 0.75rem 15px;
    }
    
    .main-navigation ul {
        flex-direction: column;
        gap: 1rem;
    }
    
    .row {
        flex-direction: column;
    }
    
    .sidebar {
        margin-left: 0;
        margin-top: 2rem;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .site-header .container {
        padding: 0.5rem 10px;
    }
    
    .card-body,
    .card-header,
    .card-footer {
        padding: 1rem;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
}

/* Print styles */
@media print {
    .site-header,
    .main-navigation,
    .sidebar,
    .btn {
        display: none;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
        background: #fff;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }
    
    a {
        color: #000;
        text-decoration: underline;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666;
    }
}

/* WhatsApp-style Message Sidebar */
.message-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 1050;
    display: flex;
    flex-direction: column;
}

.message-sidebar.open {
    right: 0;
}

.message-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.message-tabs {
    display: flex;
    border-bottom: 1px solid #e9ecef;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn.active {
    border-bottom-color: #28a745;
    color: #28a745;
}

.tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

.search-container {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f8f9fa;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.chat-item:hover {
    background-color: #f8f9fa;
}

.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
}

.chat-info {
    flex: 1;
}

.chat-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.chat-status {
    color: #6c757d;
    font-size: 0.9em;
}

.chat-actions {
    display: flex;
    gap: 10px;
}

.chat-area {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-back {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.chat-input-container {
    padding: 15px;
    border-top: 1px solid #e9ecef;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-attachment, .btn-send {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.btn-attachment:hover, .btn-send:hover {
    background-color: #f8f9fa;
}

#message-input {
    flex: 1;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 10px 15px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .message-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .mobile-chat-messages {
        display: block !important;
    }
}

/* Status indicators */
.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.status-indicator.online {
    background-color: #28a745;
}

.status-indicator.offline {
    background-color: #6c757d;
}

/* Friendship status badges */
.friendship-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.friendship-badge.friends {
    background-color: #d4edda;
    color: #155724;
}

.friendship-badge.pending-sent {
    background-color: #fff3cd;
    color: #856404;
}

.friendship-badge.pending-received {
    background-color: #cce5ff;
    color: #004085;
}

.friendship-badge.none {
    background-color: #f8f9fa;
    color: #6c757d;
}

/* Action buttons */
.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn.btn-primary {
    background-color: #007bff;
    color: white;
}

.action-btn.btn-success {
    background-color: #28a745;
    color: white;
}

.action-btn.btn-warning {
    background-color: #ffc107;
    color: #212529;
}

.action-btn.btn-danger {
    background-color: #dc3545;
    color: white;
}

.action-btn:hover {
    opacity: 0.8;
}

/* Icon sizes */
.icon-small {
    width: 16px;
    height: 16px;
}

.icon-large {
    width: 24px;
    height: 24px;
}