/* SendNodes Gallery Styles - Modern Centered Design */

/* Base styles that work with the main site */
body {
    margin: 0;
    padding: 0;
    background: #f7f7f7;
    color: #222;
    font-family: 'Segoe UI', 'Roboto', Arial, Helvetica, sans-serif;
    line-height: 1.6;
}

/* Resources grid styling to match body.php */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px;
}

.resource-card {
    background: #fff;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: auto;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #e0e0e0;
}

.resource-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Ensure GIF hover effects work properly */
.sendnode-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.resource-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

/* Ensure GIF images are not affected by general img styles */
.gif-wrapper-sendnodes img {
    width: 100% !important;
    height: 140px !important;
    object-fit: cover !important;
    display: block !important;
}

.resource-card .resource-overlay {
    background: #f6f6f6;
    color: #222;
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.resource-card h3 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
    color: #333;
}

.resource-card p {
    margin: 0 0 16px 0;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #666;
    flex: 1;
}

.resource-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    position: relative;
}

.resource-actions .btn {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 0;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-sendnode {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    color: white;
    font-weight: 600;
}

.btn-sendnode:hover {
    background: linear-gradient(135deg, #e55722, #e6732a);
}

.btn-secondary {
    background: #666;
    color: #fff;
    border: 1px solid #666;
}

.btn-secondary:hover {
    background: #555;
}

.sendnode-card {
    border-left: 4px solid #ff6b35;
}

.sendnode-card:hover {
    border-left-color: #e65100;
}

/* GIF hover functionality for sendnodes to match body.php */
.gif-wrapper-sendnodes {
    position: relative;
    width: 100%;
    height: 140px;
    overflow: hidden;
    /* Isolate from parent transforms */
    transform: translateZ(0);
    backface-visibility: hidden;
}

.gif-static-sendnodes, .gif-animated-sendnodes {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 0;
    transition: opacity 0.3s ease;
    /* Ensure images don't inherit parent transforms */
    transform: translateZ(0);
    backface-visibility: hidden;
}

.gif-animated-sendnodes {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
}

/* GIF hover effects with high specificity */
.resource-card.sendnode-card:hover .gif-wrapper-sendnodes .gif-static-sendnodes {
    opacity: 0 !important;
    transform: translateZ(0) !important;
    transition: opacity 0.3s ease !important;
}

.resource-card.sendnode-card:hover .gif-wrapper-sendnodes .gif-animated-sendnodes {
    opacity: 1 !important;
    transform: translateZ(0) !important;
    transition: opacity 0.3s ease !important;
}

@media (max-width: 768px) {
    .resources-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
        padding: 15px;
    }
    
    .resource-card img,
    .gif-wrapper-sendnodes {
        height: 120px;
    }
    
    .resource-actions {
        flex-direction: column;
    }
    
    .resource-actions .btn {
        width: 100%;
        text-align: center;
    }
}

/* Main content wrapper - ensures proper centering */
.main-content {
    background: #f7f7f7;
    min-height: calc(100vh - 200px);
    padding: 20px 0;
}

/* Page center container - max width and centering */
.page-center {
    width: 95%;
    max-width: 1600px;
    margin: 0 auto;
    background: #fff;
    min-height: 600px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
}

/* Payload-specific header section */
.payload-header {
    padding: 40px 32px 20px 32px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(135deg, #fff 0%, #fafafa 100%);
}

.payload-header h1 {
    font-size: 2.8rem;
    margin: 0;
    color: #222;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.payload-header .muted {
    color: #666;
    font-size: 1.1rem;
    margin-top: 12px;
    line-height: 1.5;
    max-width: 600px;
}

/* Search functionality */
.search {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 16px;
}

.search.prominent {
    margin-top: 0;
    padding: 20px;
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(255,107,53,0.3);
}

.search.prominent input {
    padding: 16px 20px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.95);
    color: #222;
    min-width: 400px;
    font-size: 1.1rem;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    font-weight: 600;
}

.search.prominent input:focus {
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.3);
    transform: translateY(-1px);
    background: #fff;
}

.search.prominent input::placeholder {
    color: #666;
    font-style: normal;
    font-weight: 500;
}

/* Grid layout - responsive and centered */
.grid {
    padding: 40px 32px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
    align-items: start;
}

.grid.grid-5-cols {
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

/* Addon notice */
.addon-notice {
    padding: 20px 32px;
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border-bottom: 2px solid #f0f0f0;
    text-align: center;
}

.addon-notice p {
    margin: 0;
    color: #856404;
    font-size: 1.1rem;
    font-weight: 600;
}

.addon-notice a {
    color: #ff6b35;
    text-decoration: none;
    font-weight: 700;
}

.addon-notice a:hover {
    text-decoration: underline;
}

/* Category Tabs */
.category-tabs {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 32px;
    background: #f8f9fa;
    border-bottom: 2px solid #f0f0f0;
    gap: 8px;
    flex-wrap: wrap;
}

.tab-button {
    padding: 12px 24px;
    border: 2px solid #e9ecef;
    background: #fff;
    color: #666;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: capitalize;
    letter-spacing: 0.02em;
    outline: none;
}

.tab-button:hover {
    border-color: #ff6b35;
    color: #ff6b35;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.2);
}

.tab-button.active {
    background: linear-gradient(135deg, #e65100, #ff6d00);
    border-color: #e65100;
    color: #fff;
    box-shadow: 0 6px 20px rgba(230, 81, 0, 0.4);
    transform: translateY(-2px);
}

.tab-button.active:hover {
    color: #fff;
}

@media (max-width: 768px) {
    .category-tabs {
        gap: 6px;
        padding: 15px 20px;
    }
    
    .tab-button {
        padding: 10px 18px;
        font-size: 0.9rem;
    }
}

/* Card styling - modern and clean */
.card {
    background: #fff;
    border: 2px solid #f0f0f0;
    /* border-radius: 16px; */
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card-image {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    width: 100%;
}

.card-image img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    transition: all 0.3s ease;
}

.card:hover .card-image img {
    transform: scale(1.02);
}

/* Override for GIF wrapper images - prevent transform conflicts */
.gif-wrapper .gif-static,
.gif-wrapper .gif-animated {
    transition: opacity 0.3s ease !important;
    transform: none !important;
}

.card:hover .gif-wrapper .gif-static {
  opacity: 0 !important;
  /* Ensure no transform interference */
  transform: translateZ(0) !important;
}

.card:hover .gif-wrapper .gif-animated {
  opacity: 1 !important;
  /* Ensure no transform interference */
  transform: translateZ(0) !important;
}

/* Ensure card-image doesn't interfere with gif-wrapper */
.card-image .gif-wrapper {
    transition: none !important;
}

.card:hover .card-image .gif-wrapper {
    transform: none !important;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff6b35, #ff8c42);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover {
    border-color: #ff6b35;
    box-shadow: 0 12px 40px rgba(255,107,53,0.15);
    transform: translateY(-4px);
}

.card:hover::before {
    opacity: 1;
}

.card .title {
    font-weight: 700;
    font-size: 1.3rem;
    color: #222;
    line-height: 1.3;
    margin: 0;
}

/* Pills/tags styling */
.pill {
    display: inline-block;
    padding: 3px;
    border-radius: 10px;
    font-size: 0.65rem;
    /* font-weight: 600; */
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #495057;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.pill:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    transform: translateY(-1px);
}

.row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Button styling */
.buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

button, .dl button {
    padding: 6px 10px;
    /* border-radius: 10px; */
    border: 2px solid #e0e0e0;
    background: #fff;
    color: #222;
    cursor: pointer;
    /* font-weight: 600; */
    /* font-size: 0.95rem; */
    transition: all 0.3s ease;
    text-align: center;
    /* min-height: 44px;*/
}

/* GIF hover optimization */
.gif-wrapper {
  position: relative;
  width: 100%;
  height: 120px;
  overflow: hidden;
  border-radius: 8px;
  /* Isolate from parent transforms */
  transform: translateZ(0);
  backface-visibility: hidden;
}

.gif-static, .gif-animated {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  transition: opacity 0.3s ease;
  /* Ensure images don't inherit parent transforms */
  transform: translateZ(0);
  backface-visibility: hidden;
}

.gif-animated {
  opacity: 0;
  pointer-events: none;
}

/* View Details button styling */
.view-details {
    padding: 6px 10px;
    border: 2px solid #e0e0e0;
    background: #f8f9fa;
    color: #666;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    text-align: center;
}

button:hover, .dl button:hover {
    border-color: #ff6b35;
    background: #ff6b35;
    color: #fff;
    transform: translateY(-2px);
}

.view-details:hover {
    border-color: #6c757d;
    background: #6c757d;
    color: #fff;
    transform: translateY(-2px);
}

.copy {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-color: #dee2e6;
}

.copy:hover {
    background: #ff6b35;
    border-color: #ff6b35;
    box-shadow: 0 4px 15px rgba(255,107,53,0.4);
}

.url {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-color: #dee2e6;
}

.dl {
    text-decoration: none;
}

/* Status colors */
.ok { color: #10b981; }
.warn { color: #f59e0b; }
.err { color: #ef4444; }

/* Empty state */
.empty {
    padding: 100px 40px;
    text-align: center;
    color: #666;
    font-size: 1.2rem;
    grid-column: 1 / -1;
}

.empty code {
    background: #f0f0f0;
    padding: 6px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    color: #d73a49;
    font-weight: 600;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    background: #222;
    color: #fff;
    border: 1px solid #333;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
    font-weight: 600;
    font-size: 1rem;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-8px);
}

/* Loading overlay styles for copy payload functionality */
.loading-overlay {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 107, 53, 0.95);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 10;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.loading-overlay.show {
    opacity: 1;
    bottom: -70px;
}

.loading-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: white;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s ease;
    animation: loading-pulse 1.5s ease-in-out infinite;
}

@keyframes loading-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Loading button animation */
.btn-sendnode.loading {
    position: relative;
    pointer-events: none;
}

.btn-sendnode.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: button-loading-spinner 1s linear infinite;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

@keyframes button-loading-spinner {
    from { transform: translateY(-50%) rotate(0turn); }
    to { transform: translateY(-50%) rotate(1turn); }
}

@media (max-width: 768px) {
    .payload-header {
        padding: 28px 20px 16px 20px;
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .payload-header h1 {
        font-size: 2.2rem;
    }

    .search {
        width: 100%;
        margin-top: 20px;
    }

    .search input {
        min-width: auto;
        width: 100%;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .search.prominent {
        padding: 16px;
    }

    .search.prominent input {
        min-width: auto;
        width: 100%;
    }

    .grid {
        padding: 24px 20px;
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .grid.grid-5-cols {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .addon-notice {
        padding: 16px 20px;
    }

    .card {
        padding: 20px;
    }

    .buttons {
        flex-direction: column;
    }

    button, .dl button {
        width: 100%;
        text-align: center;
    }

    .page-center {
        width: 98%;
        border-radius: 8px;
    }
}

@media (max-width: 480px) {
    .payload-header h1 {
        font-size: 1.8rem;
    }

    .grid {
        padding: 16px;
        gap: 16px;
    }

    .grid.grid-5-cols {
        grid-template-columns: 1fr;
    }

    .addon-notice {
        padding: 12px 16px;
    }

    .card {
        padding: 16px;
    }

    .toast {
        bottom: 20px;
        left: 20px;
        right: 20px;
        transform: none;
        text-align: center;
    }

    .toast.show {
        transform: translateY(-8px);
    }
}

/* Loading animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.6s ease-out;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }
.card:nth-child(5) { animation-delay: 0.5s; }

/* Focus states for accessibility */
button:focus, .search input:focus {
    outline: 2px solid #ff6b35;
    outline-offset: 2px;
}

/* Description styling */
.description {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 8px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 2;
}

/* Categories styling */
.categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.category {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
    color: #2e7d32;
    border: 1px solid #a5d6a7;
    transition: all 0.2s ease;
    text-transform: capitalize;
}

.category:hover {
    background: linear-gradient(135deg, #c8e6c9 0%, #a5d6a7 100%);
    transform: translateY(-1px);
}

/* Print styles */
@media print {
    .search, .buttons, .toast {
        display: none !important;
    }

    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* Top floating notification for payload copying */
.payload-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    padding: 0;
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.payload-notification.show {
    transform: translateY(0);
}

.payload-notification-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.payload-icon {
    font-size: 24px;
    margin-right: 12px;
    animation: pulse 2s infinite;
}

.payload-text {
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    flex: 1;
}

.payload-close {
    position: absolute;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.payload-close:hover {
    background: rgba(255,255,255,0.2);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
