/*
Staking Main Page Styles
Only for the main /staking page, not child pages
Template: page-staking.php
*/

.staking-plugins-container {
    display: flex;
    gap: 10px;
}
@media (max-width: 768px) {
    .staking-plugins-container {
        display: none;
    }
}

/* Header Section Styles */
.staking-header {
    margin-bottom: 50px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--border-color, #e0e0e0);
}

.staking-title {
    font-size: 2.8em;
    font-weight: 700;
    color: var(--text-heading, #1a1a1a);
    margin-bottom: 25px;
    line-height: 1.3;
}

.staking-description {
    font-size: 1.2em;
    line-height: 1.9;
    color: var(--text-body, #4a4a4a);
    max-width: 900px;
    margin: 0 auto;
    text-align: justify;
}

/* Responsive Styles for Header */
@media (max-width: 768px) {
    .staking-header {
        margin-bottom: 40px;
        padding-bottom: 25px;
    }
    
    .staking-title {
        font-size: 2.2em;
        margin-bottom: 20px;
    }
    
    .staking-description {
        font-size: 1.1em;
        line-height: 1.8;
        text-align: justify;
    }
}

@media (max-width: 480px) {
    .staking-title {
        font-size: 1.8em;
        margin-bottom: 15px;
    }
    
    .staking-description {
        font-size: 1em;
        line-height: 1.7;
    }
}

/* ============================================
   Staking Plans Table Styles
   ============================================ */

/* Staking Plans Section */
.staking-plans-section {
    direction: rtl;
    font-family: "IRANSansWeb", sans-serif;
    margin-top: 40px;
    margin-bottom: 40px;
}

/* Table Header (Search and Actions) */
.staking-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.staking-search-container {
    display: flex;
    justify-content: flex-end;
    flex: 1;
}

.staking-search-input {
    border: 1px dashed #3b82f6;
    border-radius: 8px;
    padding: 10px 14px;
    font-family: "IRANSansWeb", sans-serif;
    font-size: 0.9rem;
    background: transparent;
    transition: all 0.3s ease;
    width: 40%;
    max-width: 300px;
}

.staking-search-input:focus {
    outline: none;
    border: 1px solid #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Table Actions */
.staking-table-actions {
    display: flex;
    align-items: center;
}

.staking-my-plans-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--accent-primary, #3b82f6);
    border-radius: 4px;
    color: var(--accent-primary, #3b82f6);
    text-decoration: none;
    font-weight: 600;
    font-family: "IRANSansWeb", sans-serif;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.staking-my-plans-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary, #3b82f6);
    text-decoration: none;
}

.staking-my-plans-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Table Container */
.staking-table-container {
    position: relative;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 4px;
    box-shadow: var(--shadow-card, rgba(0, 0, 0, 0.1));
    overflow-x: auto;
    min-height: 400px;
}

/* Loading Spinner */
.staking-table-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
}

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

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

/* Staking Plans Table */
.staking-plans-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.staking-plans-table thead {
    position: sticky;
    top: 0;
    background: #fafafa;
    z-index: 2;
}

.staking-plans-table th {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
    background: #fafafa;
    font-family: "IRANSansWeb", sans-serif;
    font-size: 0.85rem;
}

/* Right align coin column header */
.staking-plans-table th:first-child {
    text-align: right !important;
    padding-right: 30px;
}

.staking-plans-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #ddd;
    font-family: "IRANSansWeb", sans-serif;
    vertical-align: middle;
    font-size: 0.85rem;
}

.staking-plans-table tbody tr:hover {
    background-color: #f1f5ff;
}

/* Coin Cell */
.staking-coin-cell {
    text-align: right !important;
}

.staking-coin-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}

.staking-coin-image {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    object-fit: contain;
}

.staking-coin-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.staking-coin-name {
    font-weight: 500;
    color: var(--text-heading, #1e1e2f);
    line-height: 1.4;
    font-size: 0.85rem;
    text-align: right;
}

.staking-coin-symbol {
    font-size: 0.75em;
    color: #888;
    font-weight: 400;
    line-height: 1.2;
    text-align: right;
}

/* APR Cell */
.staking-apr-cell {
    font-weight: 600;
    color: #3b82f6;
}

/* Status Cell */
.staking-status-cell {
    text-align: center;
}

.staking-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.staking-status.status-active {
    color: #16a34a;
    background: rgba(22, 163, 74, 0.1);
}

.staking-status.status-inactive {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
}

/* Unstake Cell */
.staking-unstake-cell {
    font-weight: 500;
}

/* Limit and Capacity Cells */
.staking-limit-cell,
.staking-capacity-cell {
    font-weight: 500;
}

/* Date Cells */
.staking-date-cell {
    font-weight: 500;
}

/* Operations Cell */
.staking-operations-cell {
    text-align: center;
}

.staking-operations-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
}

.staking-stake-btn {
    background: #3b82f6;
    border: none;
    color: white;
    padding: 6px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-family: "IRANSansWeb", sans-serif;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.staking-chevron-btn {
    background: transparent;
    border: none;
    color: #666;
    padding: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 4px;
}

.staking-three-dots-icon {
    width: 20px;
    height: 20px;
    display: block;
    transition: all 0.3s ease;
}

.staking-chevron-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    border-radius: 4px;
}

.staking-chevron-btn:hover .staking-three-dots-icon {
    opacity: 0.8;
}

.staking-chevron-btn.open {
    background: rgba(59, 130, 246, 0.1);
    border-radius: 50%;
}

.staking-chevron-btn.open .staking-three-dots-icon {
    opacity: 1;
}

/* Accordion Row */
.staking-accordion-row {
    display: none;
}

.staking-accordion-row[style*="table-row"] {
    animation: slideDown 0.3s ease-out;
}

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

.staking-accordion-content {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.staking-accordion-cell {
    padding: 0 !important;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.staking-accordion-content {
    padding: 12px 16px;
}

.staking-accordion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.staking-accordion-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.staking-accordion-label {
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
}

.staking-accordion-value {
    font-size: 0.8rem;
    color: #1e1e2f;
    font-weight: 500;
    line-height: 1.3;
    text-align: left;
}

/* Main row expanded state */
.staking-main-row.expanded {
    border-bottom: none;
}

.staking-stake-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.staking-stake-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* No Result Message */
.staking-no-result {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #666;
    font-size: 0.9rem;
    text-align: center;
}

.staking-no-result span {
    margin-top: 10px;
}

/* Responsive Styles for Table */
@media (max-width: 1024px) {
    .staking-plans-table {
        font-size: 0.8rem;
    }
    
    .staking-plans-table th,
    .staking-plans-table td {
        padding: 10px 6px;
        font-size: 0.8rem;
    }
    
    .staking-accordion-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 10px;
    }
    
    .staking-accordion-content {
        padding: 12px;
    }
}

@media (max-width: 768px) {
    .staking-table-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .staking-search-container {
        width: 100%;
        justify-content: center;
    }
    
    .staking-search-input {
        max-width: 100%;
    }
    
    .staking-table-actions {
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }
    
    .staking-my-plans-btn {
        font-size: 0.85rem;
        padding: 6px 14px;
    }
    
    .staking-plans-table {
        font-size: 0.75rem;
    }
    
    .staking-plans-table th,
    .staking-plans-table td {
        padding: 8px 4px;
        font-size: 0.75rem;
    }
    
    .staking-accordion-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .staking-accordion-content {
        padding: 10px;
    }
    
    .staking-accordion-item {
        gap: 8px;
    }
    
    .staking-accordion-label {
        font-size: 0.7rem;
    }
    
    .staking-accordion-value {
        font-size: 0.75rem;
    }
    
    .staking-operations-wrapper {
        gap: 6px;
    }
    
    .staking-stake-btn {
        padding: 5px 12px;
        font-size: 0.75rem;
    }
    
    .staking-chevron-btn {
        padding: 3px;
        min-width: 22px;
        height: 22px;
    }
    
    .staking-three-dots-icon {
        width: 18px;
        height: 18px;
    }
    
    .staking-coin-image {
        width: 30px;
        height: 30px;
    }
    
    .staking-coin-name {
        font-size: 0.75rem;
    }
    
    .staking-coin-symbol {
        font-size: 0.7em;
    }
    
    .staking-stake-btn {
        padding: 5px 12px;
        font-size: 0.75rem;
    }
    
    .staking-status {
        font-size: 0.7rem;
        padding: 3px 8px;
    }
}

@media (max-width: 480px) {
    .staking-plans-table th,
    .staking-plans-table td {
        padding: 6px 3px;
        font-size: 0.7rem;
    }
    
    .staking-coin-image {
        width: 24px;
        height: 24px;
    }
    
    .staking-coin-name {
        font-size: 0.7rem;
    }
    
    .staking-coin-symbol {
        font-size: 0.65em;
    }
    
    .staking-stake-btn {
        padding: 4px 10px;
        font-size: 0.7rem;
    }
    
    .staking-chevron-btn {
        padding: 2px;
        min-width: 20px;
        height: 20px;
    }
    
    .staking-three-dots-icon {
        width: 16px;
        height: 16px;
    }
    
    .staking-status {
        font-size: 0.65rem;
        padding: 2px 6px;
    }
}

/* Dark theme support */
[data-theme="dark"] .staking-plans-section {
    color: var(--text-body);
}

[data-theme="dark"] .staking-table-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .staking-plans-table {
    background: var(--card-bg);
    color: var(--text-body);
}

[data-theme="dark"] .staking-plans-table thead {
    background: var(--header-bg);
}

[data-theme="dark"] .staking-plans-table th {
    background: var(--header-bg);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .staking-plans-table td {
    border-bottom: 1px solid var(--border-color);
    color: var(--text-body);
}

[data-theme="dark"] .staking-plans-table tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

[data-theme="dark"] .staking-coin-name {
    color: var(--text-primary);
}

[data-theme="dark"] .staking-coin-symbol {
    color: #aaa;
}

[data-theme="dark"] .staking-search-input {
    background: var(--card-bg);
    color: var(--text-body);
    border: 1px dashed var(--accent-primary);
}

[data-theme="dark"] .staking-search-input:focus {
    border: 1px solid var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(61, 114, 254, 0.2);
}

[data-theme="dark"] .staking-table-loading {
    background: rgba(0, 0, 0, 0.9);
}

[data-theme="dark"] .staking-spinner {
    border-color: #333;
    border-top-color: var(--accent-primary);
}

[data-theme="dark"] .staking-chevron-btn:hover {
    background: rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .staking-chevron-btn.open {
    background: rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .staking-three-dots-icon {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

[data-theme="dark"] .staking-chevron-btn:hover .staking-three-dots-icon,
[data-theme="dark"] .staking-chevron-btn.open .staking-three-dots-icon {
    opacity: 1;
}

[data-theme="dark"] .staking-accordion-cell {
    background: var(--header-bg);
    border-top: 1px solid var(--border-color, #333);
}

[data-theme="dark"] .staking-accordion-content {
    background: transparent;
}

[data-theme="dark"] .staking-accordion-label {
    color: var(--text-secondary, #aaa);
}

[data-theme="dark"] .staking-accordion-value {
    color: var(--text-body, #e0e0e0);
}

/* ============================================
   MOBILE VERSION STYLES
   ============================================ */

/* Hide desktop table on mobile, show mobile list */
@media (max-width: 768px) {
    .staking-plans-desktop {
        display: none !important;
    }
    
    .staking-plans-mobile {
        display: block;
    }
}

/* Hide mobile list on desktop, show desktop table */
@media (min-width: 769px) {
    .staking-plans-mobile {
        display: none !important;
    }
    
    .staking-plans-desktop {
        display: block;
    }
}

/* Mobile Header */
.staking-mobile-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 0;
    background: transparent;
}

.staking-mobile-search-container {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.staking-mobile-search-input {
    border: 1px dashed #3b82f6;
    border-radius: 8px;
    padding: 10px 14px;
    font-family: "IRANSansWeb", sans-serif;
    font-size: 0.9rem;
    background: transparent;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 300px;
    color: var(--text-body, #1a1a1a);
}

.staking-mobile-search-input:focus {
    outline: none;
    border: 1px solid #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.staking-mobile-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.staking-mobile-my-plans-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--accent-primary, #3b82f6);
    border-radius: 4px;
    color: var(--accent-primary, #3b82f6);
    text-decoration: none;
    font-weight: 600;
    font-family: "IRANSansWeb", sans-serif;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
}

.staking-mobile-my-plans-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary, #3b82f6);
    text-decoration: none;
}

.staking-mobile-my-plans-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Mobile Loading */
.staking-mobile-loading {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

.staking-mobile-loading.show {
    display: flex;
}

/* Mobile List Container */
.staking-mobile-list-container {
    min-height: 200px;
}

.staking-mobile-no-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary, #666);
    font-size: 0.9rem;
    text-align: center;
}

/* Mobile List */
.staking-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Mobile List Item */
.staking-mobile-item {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.staking-mobile-item:hover {
    border-color: var(--accent-primary, #3b82f6);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.staking-mobile-item.active {
    border: 1px solid var(--accent-primary, #3b82f6);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

/* Mobile Item Header */
.staking-mobile-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.staking-mobile-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.staking-mobile-icon-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4px;
    border-radius: 9px;
    background-color: #eaeffa;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.staking-mobile-icon-wrapper img {
    width: 33px;
    height: 33px;
    object-fit: contain;
    border-radius: 50%;
}

.staking-mobile-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

.staking-mobile-item-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
    line-height: 1.3;
    text-align: right;
}

.staking-mobile-item-symbol {
    font-size: 0.75rem;
    color: var(--text-secondary, #666);
    line-height: 1.3;
    text-align: right;
}

.staking-mobile-item-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.staking-mobile-status-chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
}

.staking-mobile-status-chip.status-active {
    background: #10b981;
}

.staking-mobile-status-chip.status-inactive {
    background: #ef4444;
}

.staking-mobile-apr {
    font-size: 0.75rem;
    color: var(--text-secondary, #666);
}

.staking-mobile-apr-value {
    color: var(--accent-primary, #3b82f6);
    font-weight: 700;
}

/* Mobile Accordion Content */
.staking-mobile-accordion {
    display: none;
    padding-top: 16px;
    animation: slideDown 0.3s ease;
}

.staking-mobile-item.active .staking-mobile-accordion {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 1000px;
        transform: translateY(0);
    }
}

.staking-mobile-accordion-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.staking-mobile-accordion-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.staking-mobile-accordion-label {
    font-size: 0.85rem;
    color: var(--text-secondary, #666);
    font-weight: 500;
}

.staking-mobile-accordion-value {
    font-size: 0.85rem;
    color: var(--text-primary, #1a1a1a);
    font-weight: 500;
    text-align: left;
}

.staking-mobile-accordion-value.text-bold {
    font-weight: 700;
}

.staking-mobile-accordion-value.text-primary {
    color: var(--accent-primary, #3b82f6);
}

.staking-mobile-accordion-value.text-positive {
    color: #10b981;
}

.staking-mobile-accordion-value.text-negative {
    color: #ef4444;
}

.staking-mobile-accordion-value .span-color {
    color: var(--text-secondary, #666);
    margin-right: 4px;
}

/* Mobile Stake Button */
.staking-mobile-stake-btn {
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    background: var(--accent-primary, #3b82f6);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: "IRANSansWeb", sans-serif;
}

.staking-mobile-stake-btn:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.staking-mobile-stake-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Dark Theme for Mobile */
[data-theme="dark"] .staking-mobile-header {
    background: var(--card-bg, #1a1a1a);
}

[data-theme="dark"] .staking-mobile-search-input {
    background: transparent;
    color: var(--text-body);
    border: 1px dashed var(--accent-primary);
}

[data-theme="dark"] .staking-mobile-search-input:focus {
    border: 1px solid var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(61, 114, 254, 0.2);
}

[data-theme="dark"] .staking-mobile-item {
    background: var(--card-bg, #1a1a1a);
    border-color: var(--border-color, #333);
}

[data-theme="dark"] .staking-mobile-item-name {
    color: var(--text-primary, #e0e0e0);
}

[data-theme="dark"] .staking-mobile-item-symbol {
    color: var(--text-secondary, #aaa);
}

[data-theme="dark"] .staking-mobile-apr {
    color: var(--text-secondary, #aaa);
}

[data-theme="dark"] .staking-mobile-accordion-label {
    color: var(--text-secondary, #aaa);
}

[data-theme="dark"] .staking-mobile-accordion-value {
    color: var(--text-body, #e0e0e0);
}

[data-theme="dark"] .staking-mobile-icon-wrapper {
    background-color: rgba(59, 130, 246, 0.1);
}