/**
 * RCAD User Resources - Frontend Styles
 * 
 * @package RCAD_User_Resources
 * @version 1.0.0
 */

/* ============================================
   FORMULARIO DE ENVÍO
   ============================================ */

.rcad-ur-form-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.rcad-ur-submissions-counter {
    background: #f0f6ff;
    border-left: 4px solid #007AFF;
    padding: 15px 20px;
    margin-bottom: 30px;
    border-radius: 4px;
}

.rcad-ur-submissions-counter p {
    margin: 0;
    font-size: 14px;
    color: #333;
}

.rcad-ur-submissions-counter strong {
    color: #007AFF;
    font-size: 16px;
}

/* Notices */
.rcad-ur-notice {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 4px;
    border-left: 4px solid;
}

.rcad-ur-notice-error {
    background: #fff0f0;
    border-color: #dc3545;
    color: #721c24;
}

.rcad-ur-notice-warning {
    background: #fff8e1;
    border-color: #ffc107;
    color: #856404;
}

.rcad-ur-notice-success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

/* Form */
.rcad-ur-form {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #e6eaf0;
    box-shadow: none;
}

.rcad-ur-field {
    margin-bottom: 25px;
}

.rcad-ur-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.rcad-ur-required {
    color: #dc3545;
    font-weight: bold;
}

.rcad-ur-input,
.rcad-ur-textarea,
.rcad-ur-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.3s;
    font-family: inherit;
}

.rcad-ur-input:focus,
.rcad-ur-textarea:focus,
.rcad-ur-select:focus {
    outline: none;
    border-color: #f6a800;
    box-shadow: none;
}

.rcad-ur-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Category finder */
.rcad-ur-category-field {
    padding: 18px;
    border: 1px solid #e3e8f0;
    border-radius: 14px;
    background: #fbfcff;
}

.rcad-ur-category-intro {
    margin: -4px 0 14px;
    color: #556176;
    font-size: 14px;
    line-height: 1.45;
}

.rcad-ur-category-search {
    margin-bottom: 10px;
}

.rcad-ur-category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}

.rcad-ur-category-chips button {
    appearance: none;
    border: 1px solid #dbe3ee;
    border-radius: 999px;
    background: #fff;
    color: #071b46;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    padding: 8px 12px;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.rcad-ur-category-chips button:hover,
.rcad-ur-category-chips button:focus {
    background: #fff6df;
    border-color: #f6a800;
    color: #071b46;
}

.rcad-ur-category-missing {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #d8e0ea;
}

.rcad-ur-category-missing label {
    display: block;
    margin-bottom: 7px;
    color: #344054;
    font-size: 13px;
    font-weight: 700;
}

.rcad-ur-category-missing .rcad-ur-help-text {
    margin-top: 7px;
}

.rcad-ur-textarea.rcad-ur-content {
    min-height: 200px;
    line-height: 1.6;
}

.rcad-ur-help {
    display: block;
    margin-top: 5px;
    font-size: 13px;
    color: #666;
}

.rcad-ur-char-counter,
.rcad-ur-word-counter {
    font-style: italic;
}

.rcad-ur-file {
    padding: 10px 0;
}

.rcad-ur-image-preview {
    margin-top: 15px;
    border: 2px dashed #e0e0e0;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
}

.rcad-ur-image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 4px;
}

/* Checkbox field */
.rcad-ur-field-checkbox {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.rcad-ur-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    cursor: pointer;
}

.rcad-ur-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.rcad-ur-checkbox-label a {
    color: #d88f00;
    font-weight: 700;
    text-decoration: none;
}

.rcad-ur-checkbox-label a:hover,
.rcad-ur-checkbox-label a:focus {
    text-decoration: underline;
}

.rcad-ur-recaptcha-field {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.rcad-ur-recaptcha-field .g-recaptcha {
    max-width: 100%;
}

/* Submit button */
.rcad-ur-field-submit {
    margin-top: 30px;
    text-align: center;
}

.rcad-ur-submit-btn {
    background: linear-gradient(135deg, #f6a800 0%, #d88f00 100%);
    color: #fff;
    padding: 15px 40px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: none;
    min-width: 250px;
}

.rcad-ur-submit-btn:hover {
    transform: none;
    box-shadow: none;
}

.rcad-ur-submit-btn:active {
    transform: translateY(0);
}

.rcad-ur-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.rcad-ur-btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

/* Avatar de usuario */
.rcad-ur-avatar-form {
    max-width: 620px;
    margin: 20px auto;
}

.rcad-ur-avatar-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 18px;
    align-items: center;
    padding: 22px;
    border: 1px solid #e4e8ef;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(15, 23, 42, .06);
}

.rcad-ur-avatar-preview {
    width: 96px;
    height: 96px;
    overflow: hidden;
    border: 4px solid #f6a800;
    border-radius: 50%;
    background: #f8fafc;
}

.rcad-ur-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rcad-ur-avatar-body h3 {
    margin: 0 0 6px;
    color: #071b46;
    font-size: 20px;
}

.rcad-ur-avatar-body p {
    margin: 0 0 14px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
}

.rcad-ur-avatar-file {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    margin: 0 10px 12px 0;
    padding: 0 15px;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    background: #fff;
    color: #071b46;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.rcad-ur-avatar-file:hover,
.rcad-ur-avatar-file:focus-within {
    border-color: #f6a800;
    background: #fff8ef;
}

.rcad-ur-avatar-file input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.rcad-ur-avatar-format {
    display: inline-block;
    margin: 0 0 12px;
    color: #64748b;
    font-size: 12px;
}

.rcad-ur-avatar-btn {
    min-height: 42px;
    padding: 10px 18px;
    border: 0;
    border-radius: 8px;
    background: #d97706;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.rcad-ur-avatar-btn:hover,
.rcad-ur-avatar-btn:focus {
    background: #b45309;
}

@media (max-width: 560px) {
    .rcad-ur-avatar-card {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }
}

.rcad-ur-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: rcad-ur-spin 0.8s linear infinite;
}

@keyframes rcad-ur-spin {
    to { transform: rotate(360deg); }
}

/* Messages */
.rcad-ur-messages {
    margin-bottom: 20px;
}

.rcad-ur-messages .rcad-ur-notice {
    animation: rcad-ur-slide-down 0.3s ease-out;
}

@keyframes rcad-ur-slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   LISTADO DE RECURSOS
   ============================================ */

.rcad-ur-resources-list {
    display: grid;
    gap: 20px;
}

.rcad-ur-resource-item {
    display: flex;
    gap: 20px;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.rcad-ur-resource-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.rcad-ur-resource-thumbnail {
    flex-shrink: 0;
    width: 120px;
}

.rcad-ur-resource-thumbnail img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
}

.rcad-ur-resource-content {
    flex: 1;
}

.rcad-ur-resource-title {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.rcad-ur-resource-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.rcad-ur-resource-title a:hover {
    color: #007AFF;
}

.rcad-ur-resource-excerpt {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 15px 0;
}

.rcad-ur-resource-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #999;
}

.rcad-ur-resource-meta span {
    display: inline-flex;
    align-items: center;
}

.rcad-ur-resource-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 12px;
}

.rcad-ur-status-publish {
    background: #d4edda;
    color: #155724;
}

.rcad-ur-status-pending {
    background: #fff8e1;
    color: #856404;
}

.rcad-ur-status-draft {
    background: #f8d7da;
    color: #721c24;
}

/* ============================================
   ESTADÍSTICAS
   ============================================ */

.rcad-ur-user-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.rcad-ur-stat-item {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.rcad-ur-stat-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: #007AFF;
    margin-bottom: 5px;
}

.rcad-ur-stat-label {
    display: block;
    font-size: 13px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
}

/* Storage visibility */
.rcad-ur-storage-card {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid #e5eaf1;
    border-radius: 10px;
    background: #f8fafc;
}

.rcad-ur-storage-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    color: #0f172a;
    font-size: 13px;
}

.rcad-ur-storage-provider {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 999px;
    background: #eaf6f0;
    color: #145c35;
    font-size: 11px;
    font-weight: 800;
}

.rcad-ur-storage-provider-local {
    background: #fff7ed;
    color: #9a3412;
}

.rcad-ur-storage-provider-r2 {
    background: #eef2ff;
    color: #3730a3;
}

.rcad-ur-storage-provider-gdrive {
    background: #ecfdf5;
    color: #047857;
}

.rcad-ur-copy-row {
    display: block;
    margin: 8px 0 0;
}

.rcad-ur-copy-row span {
    display: block;
    margin-bottom: 4px;
    color: #475569;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.rcad-ur-copy-row input {
    width: 100%;
    min-height: 34px;
    padding: 7px 9px;
    border: 1px solid #d8e0ea;
    border-radius: 7px;
    background: #fff;
    color: #0f172a;
    font-size: 12px;
}

.rcad-ur-storage-note {
    display: block;
    margin-top: 7px;
    font-size: 12px;
    font-weight: 700;
}

.rcad-ur-storage-note.is-ok {
    color: #047857;
}

.rcad-ur-storage-note.is-warning {
    color: #b45309;
}

/* ============================================
   DETALLES Y BOTON RCAD LIMPIO
   ============================================ */

.rcad-ur-file-details {
    margin: 32px auto;
    padding: 30px;
    border: 1px solid #e6eaf0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(10, 20, 40, .06);
}

.rcad-ur-file-details-title {
    margin: 0 0 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e8edf3;
    color: #071b46;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: .08em;
}

.rcad-ur-file-details-list {
    margin: 0;
}

.rcad-ur-file-details-list > div {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 18px;
    padding: 13px 0;
    border-bottom: 1px solid #f0f2f5;
}

.rcad-ur-file-details-list > div:last-child {
    border-bottom: 0;
}

.rcad-ur-file-details-list dt {
    color: #071b46;
    font-weight: 800;
}

.rcad-ur-file-details-list dd {
    margin: 0;
    color: #172033;
}

.rcad-ur-file-details-description dd {
    line-height: 1.65;
}

.rcad-ur-file-details-cats dd {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rcad-ur-file-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 12px;
    border-radius: 999px;
    background: #2563eb;
    color: #fff !important;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none !important;
}

.rcad-ur-download-card {
    position: relative;
    overflow: hidden;
    max-width: 620px;
    margin: 34px auto;
    padding: 30px;
    border: 1px solid rgba(18, 130, 74, .18);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 18px 48px rgba(7, 61, 37, .12);
}

.rcad-ur-download-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 6px;
    background: linear-gradient(90deg, #073d25, #12824a, #39d98a);
}

.rcad-ur-download-title {
    position: relative;
    margin: 0 0 20px;
    color: #102018;
    font-size: 28px;
    font-weight: 650;
    line-height: 1.2;
}

.rcad-ur-download-ad {
    margin: 0 0 18px;
    text-align: center;
}

.rcad-ur-download-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    padding: 16px 18px;
    border-radius: 18px;
    background: linear-gradient(135deg, #12824a, #073d25);
    color: #fff !important;
    text-decoration: none !important;
    box-shadow: 0 16px 34px rgba(18, 130, 74, .28);
}

.rcad-ur-download-icon,
.rcad-ur-download-arrow {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .16);
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.rcad-ur-download-arrow {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.rcad-ur-download-icon svg,
.rcad-ur-download-arrow svg {
    width: 22px;
    height: 22px;
    stroke: #fff;
}

.rcad-ur-download-copy {
    min-width: 0;
    flex: 1;
}

.rcad-ur-download-label,
.rcad-ur-download-sub {
    display: block;
}

.rcad-ur-download-label {
    font-size: 16px;
    font-weight: 900;
    line-height: 1.15;
}

.rcad-ur-download-sub {
    margin-top: 5px;
    color: rgba(255, 255, 255, .78);
    font-size: 12px;
    font-weight: 700;
}

.rcad-ur-download-notice {
    width: fit-content;
    margin: 16px auto 0;
    padding: 9px 16px;
    border: 1px solid #d8ebe0;
    border-radius: 999px;
    background: #f4faf7;
    color: #0b5c35;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
}

.rcad-ur-download-notice span {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #22c55e;
    color: #fff;
    display: grid;
    place-items: center;
}

.rcad-ur-download-count {
    margin: 13px 0 0;
    color: #58647a;
    text-align: center;
    font-size: 14px;
}

.rcad-ur-download-count strong {
    color: #073d25;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .rcad-ur-form-wrapper {
        padding: 10px;
    }
    
    .rcad-ur-form {
        padding: 20px;
    }
    
    .rcad-ur-resource-item {
        flex-direction: column;
    }
    
    .rcad-ur-resource-thumbnail {
        width: 100%;
    }
    
    .rcad-ur-submit-btn {
        width: 100%;
        min-width: 0;
    }

    .rcad-ur-file-details {
        padding: 20px;
    }

    .rcad-ur-file-details-list > div {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .rcad-ur-download-card {
        padding: 24px 18px;
    }

    .rcad-ur-download-title {
        font-size: 22px;
    }

    .rcad-ur-download-btn {
        padding: 14px;
    }
}
